Skip to content

Commit

Permalink
Fix unexpected blocking by input stream
Browse files Browse the repository at this point in the history
  • Loading branch information
arithy committed Apr 24, 2024
1 parent 75a5606 commit 8891430
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/packcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ DECLSPEC_IMPORT HRESULT WINAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hTo

#define WEBSITE "https://github.com/arithy/packcc"

#define VERSION "2.0.0"
#define VERSION "2.0.1"

#ifndef BUFFER_MIN_SIZE
#define BUFFER_MIN_SIZE 256
Expand Down Expand Up @@ -5404,6 +5404,10 @@ static bool_t generate(context_t *ctx) {
get_prefix(ctx), get_prefix(ctx),
vt, vp ? "" : " "
);
stream__printf(
&sstream,
" if (pcc_refill_buffer(ctx, 1) < 1) return 0;\n"
);
if (ctx->rules.len > 0) {
stream__printf(
&sstream,
Expand All @@ -5421,7 +5425,7 @@ static bool_t generate(context_t *ctx) {
stream__puts(
&sstream,
" pcc_thunk_array__revert(ctx->auxil, &ctx->thunks, 0);\n"
" return pcc_refill_buffer(ctx, 1) >= 1;\n"
" return 1;\n"
"}\n"
"\n"
);
Expand Down
4 changes: 2 additions & 2 deletions tests/debug_macro.d/expected.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Evaluating rule TOP @0 []
Evaluating rule RULE_A @0 []
Evaluating rule TOP @0 [A]
Evaluating rule RULE_A @0 [A]
Matched rule RULE_A @0 [Aaa]
Evaluating rule EOL @3 [
]
Expand Down

0 comments on commit 8891430

Please sign in to comment.