Skip to content

Commit

Permalink
Squashed 'misc/packcc/' changes from 42f36114..8fad6d2f
Browse files Browse the repository at this point in the history
8fad6d2f Merge pull request universal-ctags#2 from k-takata/use-priuptr
42c94176 Use PRIuPTR instead of SIZE_T_FMT_CHAR

git-subtree-dir: misc/packcc
git-subtree-split: 8fad6d2ff95c25fbe5de293275aded57d4965d30
  • Loading branch information
k-takata committed Feb 28, 2020
1 parent 2d2eaac commit d66b256
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
#endif
#endif

#ifndef SIZE_T_FMT_CHAR
#define SIZE_T_FMT_CHAR "z"
#endif

#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
Expand Down Expand Up @@ -2114,17 +2111,17 @@ static code_reach_t generate_matching_string_code(generate_t *gen, const char *v
write_characters(gen->stream, ' ', indent);
fputs("if (\n", gen->stream);
write_characters(gen->stream, ' ', indent + 4);
fprintf(gen->stream, "pcc_refill_buffer(ctx, %" SIZE_T_FMT_CHAR "u) < %" SIZE_T_FMT_CHAR "u ||\n", n, n);
fprintf(gen->stream, "pcc_refill_buffer(ctx, %" PRIuPTR ") < %" PRIuPTR " ||\n", n, n);
for (i = 0; i < n - 1; i++) {
write_characters(gen->stream, ' ', indent + 4);
fprintf(gen->stream, "((const char *)(ctx->buffer.buf + ctx->pos))[%" SIZE_T_FMT_CHAR "u] != '%s' ||\n", i, escape_character(value[i], &s));
fprintf(gen->stream, "((const char *)(ctx->buffer.buf + ctx->pos))[%" PRIuPTR "] != '%s' ||\n", i, escape_character(value[i], &s));
}
write_characters(gen->stream, ' ', indent + 4);
fprintf(gen->stream, "((const char *)(ctx->buffer.buf + ctx->pos))[%" SIZE_T_FMT_CHAR "u] != '%s'\n", i, escape_character(value[i], &s));
fprintf(gen->stream, "((const char *)(ctx->buffer.buf + ctx->pos))[%" PRIuPTR "] != '%s'\n", i, escape_character(value[i], &s));
write_characters(gen->stream, ' ', indent);
fprintf(gen->stream, ") goto L%04d;\n", onfail);
write_characters(gen->stream, ' ', indent);
fprintf(gen->stream, "ctx->pos += %" SIZE_T_FMT_CHAR "u;\n", n);
fprintf(gen->stream, "ctx->pos += %" PRIuPTR ";\n", n);
if (!bare) {
indent -= 4;
write_characters(gen->stream, ' ', indent);
Expand Down

0 comments on commit d66b256

Please sign in to comment.