apfl/src/internal.c
Laria Carolin Chabowski eaa6b723bc Fix refcounted strings
Increasing the refcount (confusingly called copy before, fixed that too)
didn't work properly, as the object was copied and the refcount was only
updated in one of the copies.
2022-01-04 21:22:46 +01:00

26 lines
409 B
C

#include <stdarg.h>
#include <stdio.h>
#include "apfl.h"
#include "internal.h"
void
apfl_print_indented(unsigned indent, FILE *f, const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
while (indent--) {
fputs(" ", f);
}
vfprintf(f, fmt, ap);
va_end(ap);
}
bool
apfl_refcount_dec(unsigned *rc)
{
if (rc == NULL) {
return false;
}
return --(*rc) == 0;
}