Skip to content

Commit

Permalink
c: actually fixes newline issue in headers
Browse files Browse the repository at this point in the history
actually fixes the regex (removes leftover '$'),
writes as binary and no longer in text mode to prevent
newline replacement

gh: #423
  • Loading branch information
Dav1dde committed Apr 4, 2023
1 parent 1377964 commit 2348b07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions glad/generator/c/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def resolve(target):
return resolve(member.alias)


_CPP_STYLE_COMMENT_RE = re.compile(r'(^|\s|\))//(?P<comment>[^\r^\n]*)$', flags=re.MULTILINE)
_CPP_STYLE_COMMENT_RE = re.compile(r'(^|\s|\))//(?P<comment>[^\r^\n]*)', flags=re.MULTILINE)


def replace_cpp_style_comments(inp):
Expand Down Expand Up @@ -491,8 +491,8 @@ def _add_additional_headers(self, feature_set, config):

if not os.path.exists(path):
content = self._read_header(header.url)
with open(path, 'w') as dest:
dest.write(content)
with open(path, 'wb') as dest:
dest.write(content.encode('utf-8'))

def _read_header(self, url):
if url not in self._headers:
Expand Down

0 comments on commit 2348b07

Please sign in to comment.