<div dir="ltr">It might be a good idea for the new variable name to contain the text "jmp" so that a grep for "jmp" will find it as well as uses of setjmp and longjmp. I would call it "jmp_buffer" (although "jmp_buf" and "jmpbuffer" would also avoid the AIX problem).<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 17, 2015 at 2:05 AM, Bryce Harrington <span dir="ltr"><<a href="mailto:bryce@osg.samsung.com" target="_blank">bryce@osg.samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On AIX, the token jmpbuf is a pre-processor macro.<br>
cairo-script-scanner.c includes a private struct with a member named<br>
jmpbuf which gets renamed to __jmpbuf when AIX's sys/context.h has been<br>
included.<br>
<br>
While judicious ordering of includes might kludge around this problem<br>
(by causing all references to .jmpbuf to become .__jmpbuf), it's better<br>
to simply select a new name for the struct member that won't suffer the<br>
collision.<br>
<br>
Fixes: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=89339" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=89339</a><br>
<br>
Signed-off-by: Bryce Harrington <<a href="mailto:bryce@osg.samsung.com">bryce@osg.samsung.com</a>><br>
---<br>
util/cairo-script/cairo-script-private.h | 2 +-<br>
util/cairo-script/cairo-script-scanner.c | 74 ++++++++++++++++----------------<br>
2 files changed, 38 insertions(+), 38 deletions(-)<br>
<br>
diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h<br>
index 6bf41b4..8d158d6 100644<br>
--- a/util/cairo-script/cairo-script-private.h<br>
+++ b/util/cairo-script/cairo-script-private.h<br>
@@ -435,7 +435,7 @@ union _csi_union_object {<br>
};<br>
<br>
struct _csi_scanner {<br>
- jmp_buf jmpbuf;<br>
+ jmp_buf jump_buffer;<br>
int depth;<br>
<br>
int bind;<br>
diff --git a/util/cairo-script/cairo-script-scanner.c b/util/cairo-script/cairo-script-scanner.c<br>
index 980c608..3dfb3a9 100644<br>
--- a/util/cairo-script/cairo-script-scanner.c<br>
+++ b/util/cairo-script/cairo-script-scanner.c<br>
@@ -199,13 +199,13 @@ _buffer_grow (csi_t *ctx, csi_scanner_t *scan)<br>
char *base;<br>
<br>
if (_csi_unlikely (scan->buffer.size > INT_MAX / 2))<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_NO_MEMORY));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_NO_MEMORY));<br>
<br>
offset = scan->buffer.ptr - scan->buffer.base;<br>
newsize = scan->buffer.size * 2;<br>
base = _csi_realloc (ctx, scan->buffer.base, newsize);<br>
if (_csi_unlikely (base == NULL))<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_NO_MEMORY));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_NO_MEMORY));<br>
<br>
scan->buffer.base = base;<br>
scan->buffer.ptr = base + offset;<br>
@@ -441,12 +441,12 @@ token_end (csi_t *ctx, csi_scanner_t *scan, csi_file_t *src)<br>
&scan->procedure_stack,<br>
&scan->build_procedure);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
<br>
status = csi_array_new (ctx, 0, &scan->build_procedure);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
scan->build_procedure.type |= CSI_OBJECT_ATTR_EXECUTABLE;<br>
return;<br>
@@ -454,7 +454,7 @@ token_end (csi_t *ctx, csi_scanner_t *scan, csi_file_t *src)<br>
if (_csi_unlikely<br>
(scan->build_procedure.type == CSI_OBJECT_TYPE_NULL))<br>
{<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
}<br>
<br>
if (scan->procedure_stack.len) {<br>
@@ -470,7 +470,7 @@ token_end (csi_t *ctx, csi_scanner_t *scan, csi_file_t *src)<br>
scan->build_procedure.type = CSI_OBJECT_TYPE_NULL;<br>
}<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
return;<br>
}<br>
@@ -480,19 +480,19 @@ token_end (csi_t *ctx, csi_scanner_t *scan, csi_file_t *src)<br>
if (len >= 2 && s[1] == '/') { /* substituted name */<br>
status = csi_name_new (ctx, &obj, s + 2, len - 2);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
status = _csi_name_lookup (ctx, <a href="http://obj.datum.name" rel="noreferrer" target="_blank">obj.datum.name</a>, &obj);<br>
} else { /* literal name */<br>
status = csi_name_new (ctx, &obj, s + 1, len - 1);<br>
}<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
} else {<br>
if (! _csi_parse_number (&obj, s, len)) {<br>
status = csi_name_new (ctx, &obj, s, len);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
obj.type |= CSI_OBJECT_ATTR_EXECUTABLE;<br>
}<br>
@@ -510,7 +510,7 @@ token_end (csi_t *ctx, csi_scanner_t *scan, csi_file_t *src)<br>
status = scan_push (ctx, &obj);<br>
}<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
<br>
static void<br>
@@ -531,7 +531,7 @@ string_end (csi_t *ctx, csi_scanner_t *scan)<br>
scan->buffer.base,<br>
scan->buffer.ptr - scan->buffer.base);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
if (scan->build_procedure.type != CSI_OBJECT_TYPE_NULL)<br>
status = csi_array_append (ctx,<br>
@@ -540,7 +540,7 @@ string_end (csi_t *ctx, csi_scanner_t *scan)<br>
else<br>
status = scan_push (ctx, &obj);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
<br>
static int<br>
@@ -588,7 +588,7 @@ hex_end (csi_t *ctx, csi_scanner_t *scan)<br>
scan->buffer.base,<br>
scan->buffer.ptr - scan->buffer.base);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
if (scan->build_procedure.type != CSI_OBJECT_TYPE_NULL)<br>
status = csi_array_append (ctx,<br>
@@ -597,7 +597,7 @@ hex_end (csi_t *ctx, csi_scanner_t *scan)<br>
else<br>
status = scan_push (ctx, &obj);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
<br>
static void<br>
@@ -605,7 +605,7 @@ base85_add (csi_t *ctx, csi_scanner_t *scan, int c)<br>
{<br>
if (c == 'z') {<br>
if (_csi_unlikely (scan->accumulator_count != 0))<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
<br>
buffer_check (ctx, scan, 4);<br>
buffer_add (&scan->buffer, 0);<br>
@@ -613,7 +613,7 @@ base85_add (csi_t *ctx, csi_scanner_t *scan, int c)<br>
buffer_add (&scan->buffer, 0);<br>
buffer_add (&scan->buffer, 0);<br>
} else if (_csi_unlikely (c < '!' || c > 'u')) {<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
} else {<br>
scan->accumulator = scan->accumulator*85 + c - '!';<br>
if (++scan->accumulator_count == 5) {<br>
@@ -641,7 +641,7 @@ base85_end (csi_t *ctx, csi_scanner_t *scan, cairo_bool_t deflate)<br>
case 0:<br>
break;<br>
case 1:<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
break;<br>
<br>
case 2:<br>
@@ -670,14 +670,14 @@ base85_end (csi_t *ctx, csi_scanner_t *scan, cairo_bool_t deflate)<br>
(Bytef *) scan->buffer.ptr - source,<br>
len);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
} else {<br>
status = csi_string_new (ctx,<br>
&obj,<br>
scan->buffer.base,<br>
scan->buffer.ptr - scan->buffer.base);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
<br>
if (scan->build_procedure.type != CSI_OBJECT_TYPE_NULL)<br>
@@ -687,7 +687,7 @@ base85_end (csi_t *ctx, csi_scanner_t *scan, cairo_bool_t deflate)<br>
else<br>
status = scan_push (ctx, &obj);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
<br>
static void<br>
@@ -764,7 +764,7 @@ base64_end (csi_t *ctx, csi_scanner_t *scan)<br>
scan->buffer.base,<br>
scan->buffer.ptr - scan->buffer.base);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
if (scan->build_procedure.type != CSI_OBJECT_TYPE_NULL)<br>
status = csi_array_append (ctx,<br>
@@ -773,7 +773,7 @@ base64_end (csi_t *ctx, csi_scanner_t *scan)<br>
else<br>
status = scan_push (ctx, &obj);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
<br>
static void<br>
@@ -783,7 +783,7 @@ scan_read (csi_scanner_t *scan, csi_file_t *src, void *ptr, int len)<br>
do {<br>
int ret = csi_file_read (src, data, len);<br>
if (_csi_unlikely (ret == 0))<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_READ_ERROR));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_READ_ERROR));<br>
data += ret;<br>
len -= ret;<br>
} while (_csi_unlikely (len));<br>
@@ -801,7 +801,7 @@ string_read (csi_t *ctx,<br>
<br>
status = csi_string_new (ctx, obj, NULL, len);<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
<br>
if (compressed) {<br>
uint32_t u32;<br>
@@ -1015,7 +1015,7 @@ scan_none:<br>
case 157:<br>
case 158:<br>
case 159:<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
<br>
case '#': /* PDF 1.2 escape code */<br>
{<br>
@@ -1044,7 +1044,7 @@ scan_none:<br>
status = scan_push (ctx, &obj);<br>
}<br>
if (_csi_unlikely (status))<br>
- longjmp (scan->jmpbuf, status);<br>
+ longjmp (scan->jump_buffer, status);<br>
}<br>
}<br>
return;<br>
@@ -1135,7 +1135,7 @@ scan_string:<br>
next = csi_file_getc (src);<br>
switch (next) {<br>
case EOF:<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
<br>
case 'n':<br>
string_add (ctx, scan, '\n');<br>
@@ -1229,7 +1229,7 @@ scan_string:<br>
break;<br>
}<br>
}<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
<br>
scan_hex:<br>
buffer_reset (&scan->buffer);<br>
@@ -1276,10 +1276,10 @@ scan_hex:<br>
break;<br>
<br>
default:<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
}<br>
}<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
<br>
scan_base85:<br>
buffer_reset (&scan->buffer);<br>
@@ -1306,7 +1306,7 @@ scan_base85:<br>
break;<br>
}<br>
}<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
<br>
scan_base64:<br>
buffer_reset (&scan->buffer);<br>
@@ -1324,14 +1324,14 @@ scan_base64:<br>
base64_end (ctx, scan);<br>
goto scan_none;<br>
}<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
<br>
default:<br>
base64_add (ctx, scan, c);<br>
break;<br>
}<br>
}<br>
- longjmp (scan->jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (scan->jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
}<br>
<br>
static csi_status_t<br>
@@ -1396,7 +1396,7 @@ _csi_scan_file (csi_t *ctx, csi_file_t *src)<br>
*/<br>
<br>
if (ctx->scanner.depth++ == 0) {<br>
- if ((status = setjmp (ctx->scanner.jmpbuf))) {<br>
+ if ((status = setjmp (ctx->scanner.jump_buffer))) {<br>
ctx->scanner.depth = 0;<br>
return status;<br>
}<br>
@@ -1759,7 +1759,7 @@ _translate_push (csi_t *ctx, csi_object_t *obj)<br>
case CSI_OBJECT_TYPE_PATTERN:<br>
case CSI_OBJECT_TYPE_SCALED_FONT:<br>
case CSI_OBJECT_TYPE_SURFACE:<br>
- longjmp (ctx->scanner.jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (ctx->scanner.jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
break;<br>
}<br>
<br>
@@ -1805,7 +1805,7 @@ _translate_execute (csi_t *ctx, csi_object_t *obj)<br>
case CSI_OBJECT_TYPE_PATTERN:<br>
case CSI_OBJECT_TYPE_SCALED_FONT:<br>
case CSI_OBJECT_TYPE_SURFACE:<br>
- longjmp (ctx->scanner.jmpbuf, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
+ longjmp (ctx->scanner.jump_buffer, _csi_error (CSI_STATUS_INVALID_SCRIPT));<br>
break;<br>
}<br>
<br>
@@ -1877,7 +1877,7 @@ _csi_translate_file (csi_t *ctx,<br>
csi_status_t status;<br>
struct _translate_closure translator;<br>
<br>
- if ((status = setjmp (ctx->scanner.jmpbuf)))<br>
+ if ((status = setjmp (ctx->scanner.jump_buffer)))<br>
return status;<br>
<br>
status = build_opcodes (ctx, &translator.opcodes);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
--<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" rel="noreferrer" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a></font></span></blockquote></div><br></div>