Skip to content

Commit 9f73b37

Browse files
committed
Debugging crash in VERIFY_ID
1 parent fe7886a commit 9f73b37

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

link-grammar/parse/fast-match.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct sortbin_s
7171
/**
7272
* Push a match-list element into the match-list array.
7373
*/
74-
static void push_match_list_element(fast_matcher_t *ctxt, int id, Disjunct *d)
74+
static void push_match_list_element(fast_matcher_t *ctxt, uint16_t id, Disjunct *d)
7575
{
7676
if (ctxt->match_list_end >= ctxt->match_list_size)
7777
{
@@ -81,7 +81,7 @@ static void push_match_list_element(fast_matcher_t *ctxt, int id, Disjunct *d)
8181
}
8282

8383
#ifdef VERIFY_MATCH_LIST
84-
if (id != 0) d->match_id = id;
84+
if (d) d->match_id = id;
8585
#endif
8686
ctxt->match_list[ctxt->match_list_end++] = d;
8787
}
@@ -410,7 +410,7 @@ static void match_stats(Connector *c1, Connector *c2)
410410
* clutters the source code very much, as it needs to be inserted in plenty
411411
* of places.)
412412
*/
413-
static void print_match_list(fast_matcher_t *ctxt, int id, size_t mlb, int w,
413+
static void print_match_list(fast_matcher_t *ctxt, uint16_t id, size_t mlb, int w,
414414
Connector *lc, int lw,
415415
Connector *rc, int rw,
416416
Disjunct ***mlcl, Disjunct ***mlcr)
@@ -532,7 +532,7 @@ static bool alt_connection_possible(Connector *c1, Connector *c2,
532532
* Optionally print it (for debug).
533533
* Return the match list start.
534534
*/
535-
static size_t terminate_match_list(fast_matcher_t *ctxt, int id,
535+
static size_t terminate_match_list(fast_matcher_t *ctxt, uint16_t id,
536536
size_t ml_start, int w,
537537
Connector *lc, int lw,
538538
Connector *rc, int rw,
@@ -608,10 +608,10 @@ form_match_list(fast_matcher_t *ctxt, int w,
608608
}
609609

610610
#ifdef VERIFY_MATCH_LIST
611-
static int id = 0;
612-
int lid = ++id; /* A local copy, for multi-threading support. */
611+
static _Atomic(uint16_t) id = 0;
612+
uint16_t lid = ++id; /* A local copy, for multi-threading support. */
613613
#else
614-
const int lid = 0;
614+
const uint16_t lid = 0;
615615
#endif
616616

617617
lgdebug(+D_FAST_MATCHER, "MATCH_LIST %c%c %5d mlb %zu\n",

0 commit comments

Comments
 (0)