diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 69adcb415af..f41cf8d136b 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -1205,12 +1205,13 @@ scan_c_stream (FILE *infile) c = getc (infile); } /* Copy arguments into ARGBUF. */ - while (true) + for (ptrdiff_t nested = 0; ; ) { *p++ = c; if (argbuf + sizeof argbuf <= p) fatal ("argument buffer exhausted"); - if (c == ')') + nested += (c == '(') - (c == ')'); + if (c == ')' && !nested) break; c = getc (infile); if (c < 0)