diff options
Diffstat (limited to 'contrib/bc/include/program.h')
-rw-r--r-- | contrib/bc/include/program.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/contrib/bc/include/program.h b/contrib/bc/include/program.h index e16e5c079d7d..17454057cdba 100644 --- a/contrib/bc/include/program.h +++ b/contrib/bc/include/program.h @@ -3,7 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2018-2024 Gavin D. Howard and contributors. + * Copyright (c) 2018-2025 Gavin D. Howard and contributors. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -145,6 +145,9 @@ typedef struct BcProgram #endif // BC_ENABLED + /// The number of results that have not been retired. + size_t nresults; + // The BcDig array for strmb. This uses BC_NUM_LONG_LOG10 because it is used // in bc_num_ulong2num(), which attempts to realloc, unless it is big // enough. This is big enough. @@ -207,11 +210,16 @@ typedef struct BcProgram * operands while preserving the result (which we assumed was pushed before the * actual operation). * @param p The program. - * @param nres The number of results returned by the instruction. * @param nops The number of operands used by the instruction. */ -#define bc_program_retire(p, nres, nops) \ - (bc_vec_npopAt(&(p)->results, (nops), (p)->results.len - (nres + nops))) +#define bc_program_retire(p, nops) \ + do \ + { \ + bc_vec_npopAt(&(p)->results, (nops), \ + (p)->results.len - ((p)->nresults + nops)); \ + p->nresults = 0; \ + } \ + while (0) #if DC_ENABLED |