Count how many defs in r have exactly this label AND name. */
| 57 | |
| 58 | /* Count how many defs in r have exactly this label AND name. */ |
| 59 | static int count_defs_named(CBMFileResult *r, const char *label, const char *name) { |
| 60 | int n = 0; |
| 61 | for (int i = 0; i < r->defs.count; i++) { |
| 62 | CBMDefinition *d = &r->defs.items[i]; |
| 63 | if (label && (!d->label || strcmp(d->label, label) != 0)) |
| 64 | continue; |
| 65 | if (name && (!d->name || strcmp(d->name, name) != 0)) |
| 66 | continue; |
| 67 | n++; |
| 68 | } |
| 69 | return n; |
| 70 | } |
| 71 | |
| 72 | /* Return the Nth (0-based) def matching label + name, or NULL. */ |
| 73 | static CBMDefinition *nth_def_named(CBMFileResult *r, const char *label, const char *name, int nth) { |