{
bytecode *cur;
- STAILQ_FOREACH(cur, headp, link)
- if (func(cur, d) == 0)
- return 0;
- return 1;
+ STAILQ_FOREACH(cur, headp, link) {
+ int retval = func(cur, d);
+ if (retval != 0)
+ return retval;
+ }
+ return 0;
}
dataval *
void bcs_print(FILE *f, const bytecodehead *headp);
+/* Calls func for each bytecode in the linked list of bytecodes pointed to by
+ * headp. The data pointer d is passed to each func call.
+ *
+ * Stops early (and returns func's return value) if func returns a nonzero
+ * value. Otherwise returns 0.
+ */
int bcs_traverse(bytecodehead *headp, /*@null@*/ void *d,
int (*func) (bytecode *bc, /*@null@*/ void *d));
{
section *cur;
- STAILQ_FOREACH(cur, headp, link)
- if (func(cur, d) == 0)
- return 0;
- return 1;
+ STAILQ_FOREACH(cur, headp, link) {
+ int retval = func(cur, d);
+ if (retval != 0)
+ return retval;
+ }
+ return 0;
}
bytecodehead *
void sections_print(FILE *f, const sectionhead *headp);
+/* Calls func for each section in the linked list of sections pointed to by
+ * headp. The data pointer d is passed to each func call.
+ *
+ * Stops early (and returns func's return value) if func returns a nonzero
+ * value. Otherwise returns 0.
+ */
int sections_traverse(sectionhead *headp, /*@null@*/ void *d,
int (*func) (section *sect, /*@null@*/ void *d));
{
bytecode *cur;
- STAILQ_FOREACH(cur, headp, link)
- if (func(cur, d) == 0)
- return 0;
- return 1;
+ STAILQ_FOREACH(cur, headp, link) {
+ int retval = func(cur, d);
+ if (retval != 0)
+ return retval;
+ }
+ return 0;
}
dataval *
void bcs_print(FILE *f, const bytecodehead *headp);
+/* Calls func for each bytecode in the linked list of bytecodes pointed to by
+ * headp. The data pointer d is passed to each func call.
+ *
+ * Stops early (and returns func's return value) if func returns a nonzero
+ * value. Otherwise returns 0.
+ */
int bcs_traverse(bytecodehead *headp, /*@null@*/ void *d,
int (*func) (bytecode *bc, /*@null@*/ void *d));
{
section *cur;
- STAILQ_FOREACH(cur, headp, link)
- if (func(cur, d) == 0)
- return 0;
- return 1;
+ STAILQ_FOREACH(cur, headp, link) {
+ int retval = func(cur, d);
+ if (retval != 0)
+ return retval;
+ }
+ return 0;
}
bytecodehead *
void sections_print(FILE *f, const sectionhead *headp);
+/* Calls func for each section in the linked list of sections pointed to by
+ * headp. The data pointer d is passed to each func call.
+ *
+ * Stops early (and returns func's return value) if func returns a nonzero
+ * value. Otherwise returns 0.
+ */
int sections_traverse(sectionhead *headp, /*@null@*/ void *d,
int (*func) (section *sect, /*@null@*/ void *d));