summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2025-12-14 14:45:49 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2025-12-14 14:47:21 -0800
commit19e5d27dafa84d93cb84469c9f21594c05204bb3 (patch)
tree385ae6ec60d4a17d4cf179140c76c48238e90f14 /lib-src
parentaeab91bc55db67222cb9142476916ad08d32c98f (diff)
Support nested parens in make-docfile args
* lib-src/make-docfile.c (scan_c_stream): Allow nested parens. E.g., ‘(Lisp_Object XXX (force))’ for the identifier ‘force’, where XXX is a macro. This is for future changes.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/make-docfile.c5
1 files changed, 3 insertions, 2 deletions
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)