[qfcc] Expose convert_op and ensafen free_operand

Needed for type evaluation codegen, and free_operand needs to be
null-safe.
This commit is contained in:
Bill Currie 2024-09-06 00:57:51 +09:00
parent 9c902501d7
commit 55d7d1f069
2 changed files with 5 additions and 2 deletions

View file

@ -162,6 +162,7 @@ operand_t *alias_operand (const struct type_s *type, operand_t *op,
const struct expr_s *expr); const struct expr_s *expr);
operand_t *label_operand (const struct expr_s *label); operand_t *label_operand (const struct expr_s *label);
operand_t *short_operand (short short_val, const struct expr_s *expr); operand_t *short_operand (short short_val, const struct expr_s *expr);
const char *convert_op (int op) __attribute__((const));
void free_operand (operand_t *op); void free_operand (operand_t *op);
sblock_t *new_sblock (void); sblock_t *new_sblock (void);

View file

@ -316,7 +316,9 @@ copy_operand (operand_t *src)
void void
free_operand (operand_t *op) free_operand (operand_t *op)
{ {
FREE (operands, op); if (op) {
FREE (operands, op);
}
} }
static void static void
@ -571,7 +573,7 @@ short_operand (short short_val, const expr_t *expr)
return value_operand (val, expr); return value_operand (val, expr);
} }
static const char * const char *
convert_op (int op) convert_op (int op)
{ {
switch (op) { switch (op) {