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.
26 lines
409 B
C
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;
|
|
}
|