diff --git a/lib/libevtr/evtr.c b/lib/libevtr/evtr.c index 2110d82..7bf61e7 100644 --- a/lib/libevtr/evtr.c +++ b/lib/libevtr/evtr.c @@ -442,7 +442,13 @@ static int thread_cmp(struct evtr_thread *a, struct evtr_thread *b) { - return (int)a->id - (int)b->id; + ptrdiff_t d; + d = a->id - b->id; + if (d < 0) + return -1; + if (!d) + return 0; + return 1; } #define DEFINE_MAP_FIND(prefix, type) \ @@ -1163,7 +1169,8 @@ const char * replace_strptr(void *_ctx, const char *s) { struct replace_ctx *ctx = _ctx; - return (const char *)evtr_dump_string(ctx->evtr, ctx->ts, s, EVTR_NS_DSTR); + return (const char *)(uintptr_t)evtr_dump_string(ctx->evtr, ctx->ts, s, + EVTR_NS_DSTR); } static @@ -1174,15 +1181,15 @@ replace_strid(void *_ctx, const char *s) const char *ret; ret = string_map_find(&ctx->evtr->maps[EVTR_NS_DSTR - 1].root, - (uint32_t)s); + (int)(uintptr_t)s); if (!ret) { fprintf(stderr, "Unknown id for data string\n"); ctx->evtr->errmsg = "unknown id for data string"; ctx->evtr->err = !0; } validate_string(ret); - printd(DS, "replacing strid %d (ns %d) with string '%s' (or int %#x)\n", (int)s, - EVTR_NS_DSTR, ret ? ret : "NULL", (int)ret); + printd(DS, "replacing strid %d (ns %d) with string '%s' (or int %#x)\n", + (int)(uintptr_t)s, EVTR_NS_DSTR, ret ? ret : "NULL", (int)(uintptr_t)ret); return ret; } diff --git a/lib/libevtr/ktrfmt.l b/lib/libevtr/ktrfmt.l index c60d2d5..336e585 100644 --- a/lib/libevtr/ktrfmt.l +++ b/lib/libevtr/ktrfmt.l @@ -39,6 +39,7 @@ tok_free(struct token *tok) %option outfile="ktrfmt.yy.c" %option bison-bridge %option noyywrap +%option nounput INT [0-9]+ WHITE [ \t\r] diff --git a/lib/libevtr/ktrfmt.yy.c b/lib/libevtr/ktrfmt.yy.c index 2909656..de95311 100644 --- a/lib/libevtr/ktrfmt.yy.c +++ b/lib/libevtr/ktrfmt.yy.c @@ -582,8 +582,6 @@ extern int __ktrfmtwrap (void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); - #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -714,9 +712,9 @@ YY_DECL YYSTYPE * yylval; -#line 47 "ktrfmt.l" +#line 48 "ktrfmt.l" -#line 720 "ktrfmt.yy.c" +#line 718 "ktrfmt.yy.c" yylval = yylval_param; @@ -803,12 +801,12 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 48 "ktrfmt.l" +#line 49 "ktrfmt.l" { /* ignore */ } YY_BREAK case 2: YY_RULE_SETUP -#line 49 "ktrfmt.l" +#line 50 "ktrfmt.l" { yylval->tok = tok_new(); yylval->tok->type = TOK_ID; @@ -819,7 +817,7 @@ YY_RULE_SETUP YY_BREAK case 3: YY_RULE_SETUP -#line 56 "ktrfmt.l" +#line 57 "ktrfmt.l" { yylval->tok = tok_new(); yylval->tok->type = TOK_INT; @@ -830,7 +828,7 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 63 "ktrfmt.l" +#line 64 "ktrfmt.l" { yylval = NULL; printd(LEX, "TOK_EQ\n"); @@ -839,7 +837,7 @@ YY_RULE_SETUP YY_BREAK case 5: YY_RULE_SETUP -#line 68 "ktrfmt.l" +#line 69 "ktrfmt.l" { yylval = NULL; printd(LEX, "TOK_LEFT_BRACK\n"); @@ -848,7 +846,7 @@ YY_RULE_SETUP YY_BREAK case 6: YY_RULE_SETUP -#line 73 "ktrfmt.l" +#line 74 "ktrfmt.l" { yylval = NULL; printd(LEX, "TOK_RIGHT_BRACK\n"); @@ -857,10 +855,10 @@ YY_RULE_SETUP YY_BREAK case 7: YY_RULE_SETUP -#line 79 "ktrfmt.l" +#line 80 "ktrfmt.l" ECHO; YY_BREAK -#line 864 "ktrfmt.yy.c" +#line 862 "ktrfmt.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1189,43 +1187,6 @@ static int yy_get_next_buffer (void) return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up __ktrfmttext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1858,6 +1819,6 @@ void __ktrfmtfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 79 "ktrfmt.l" +#line 80 "ktrfmt.l"