c-hdr-parser: fix issue for single argument functions
This commit is contained in:
parent
c4f47f11e5
commit
0e5dcf57d2
1 changed files with 17 additions and 4 deletions
|
@ -236,6 +236,13 @@ char * parse_c_header_decl_args(int *c, size_t *len, FILE *f) {
|
|||
(*len)++;
|
||||
}
|
||||
|
||||
s = realloc(s, *len + 1);
|
||||
s[*len] = ';';
|
||||
(*len)++;
|
||||
|
||||
//fwrite(s, 1, *len, stdout);
|
||||
//putchar('\n');
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -324,7 +331,11 @@ char * parse_c_header_sub(char *out, size_t *out_len, const char *sub, size_t su
|
|||
size_t lwlen = 0;
|
||||
char * lastword = parse_c_last_word(&lwlen, sub_decl[n]);
|
||||
|
||||
assert( lastword != NULL );
|
||||
//assert( lastword != NULL );
|
||||
if ( lastword == NULL ) {
|
||||
lastword = sub_decl[n] + strlen(sub_decl[n]);
|
||||
lwlen = 0;
|
||||
}
|
||||
|
||||
size_t type_len = (lastword - sub_decl[n]);
|
||||
size_t type_array_len = ((sub_decl[n] + strlen(sub_decl[n])) - (lastword + lwlen));
|
||||
|
@ -343,9 +354,11 @@ char * parse_c_header_sub(char *out, size_t *out_len, const char *sub, size_t su
|
|||
out[(*out_len)] = ',';
|
||||
(*out_len)++;
|
||||
|
||||
// add identifier
|
||||
memcpy(out + (*out_len), lastword, lwlen);
|
||||
(*out_len) += lwlen;
|
||||
if ( lwlen > 0 ) {
|
||||
// add identifier
|
||||
memcpy(out + (*out_len), lastword, lwlen);
|
||||
(*out_len) += lwlen;
|
||||
}
|
||||
|
||||
out[(*out_len)] = ';';
|
||||
(*out_len)++;
|
||||
|
|
Loading…
Reference in a new issue