94 buf = (
char*)
alloc(len+1);
100 for (
int i = 0; i < len; i++) {
117 uint32_t len = (str) ? strlen(str) : 0;
121 for (
int i = 0; i < len; i++) {
122 int c = fputc(str[i], outfs);
134 dealloc((
void *)str);
146 size_t bytes =
fread(data,
sizeof(
char), size, infs);
157 size_t bytes =
fwrite(data,
sizeof(
char), size, outfs);
195 for (
char* arg = va_arg(_tmp,
char*); arg !=
NULL;
196 arg = va_arg(_tmp,
char*)) {
197 arg = va_arg(_tmp,
char*);
204 for (
char* arg = va_arg(args,
char*); arg !=
NULL;
205 arg = va_arg(args,
char*)) {
207 arg = va_arg(args,
char*);
227 fprintf(fs,
"%s[nv-pair: '%s', '%s']\n", pre, nvp->
name, nvp->
val);
244 for (uint32_t i = 0; i < nvps->len; i++) {
253 FILE* fs,
const char* pre)
255 for (uint32_t i = 0; i < nvps->len; ++i) {
266 for (uint32_t i = 0; i < nvps->len; ++i) {
267 if (strcmp(nvps->lst[i].
name, name) == 0) {
268 return nvps->lst[i].
val;
279 for (uint32_t i = 0; i < nvps->len; ++i) {
280 dealloc(nvps->lst[i].
name);
281 dealloc(nvps->lst[i].
val);
void hpcfmt_free_fn(void *mem)
int hpcfmt_nvpairList_fread(HPCFMT_List(hpcfmt_nvpair_t) *nvps, FILE *infs, hpcfmt_alloc_fn alloc)
int hpcfmt_fread(void *data, size_t size, FILE *infs)
static int hpcfmt_int4_fread(uint32_t *val, FILE *infs)
int hpcfmt_nvpair_fwrite(hpcfmt_nvpair_t *nvp, FILE *fs)
static int hpcfmt_int4_fwrite(uint32_t val, FILE *outfs)
const char * hpcfmt_nvpairList_search(const HPCFMT_List(hpcfmt_nvpair_t) *nvps, const char *name)
int hpcfmt_nvpair_fread(hpcfmt_nvpair_t *inp, FILE *infs, hpcfmt_alloc_fn alloc)
int hpcfmt_nvpair_fprint(hpcfmt_nvpair_t *nvp, FILE *fs, const char *pre)
void hpcfmt_nvpairList_free(HPCFMT_List(hpcfmt_nvpair_t) *nvps, hpcfmt_free_fn dealloc)
size_t MONITOR_EXT_WRAP_NAME() fread(void *ptr, size_t size, size_t count, FILE *stream)
int hpcfmt_str_fwrite(const char *str, FILE *outfs)
int hpcfmt_nvpairs_vfwrite(FILE *out, va_list args)
#define HPCFMT_ThrowIfError(v)
void hpcfmt_str_free(const char *str, hpcfmt_free_fn dealloc)
int hpcfmt_nvpairList_fprint(const HPCFMT_List(hpcfmt_nvpair_t) *nvps, FILE *fs, const char *pre)
void * hpcfmt_alloc_fn(size_t nbytes)
size_t MONITOR_EXT_WRAP_NAME() fwrite(const void *ptr, size_t size, size_t count, FILE *stream)
int hpcfmt_fwrite(void *data, size_t size, FILE *outfs)
int hpcfmt_str_fread(char **str, FILE *infs, hpcfmt_alloc_fn alloc)