From 01dc6576f024d60f2134ce4a70b2c4f575311283 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Thu, 14 Jun 2012 01:36:33 +0300 Subject: [PATCH] cfparser,cxalloc: avoid use of struct field specifiers. Seems msvc does not support them.. --- usual/cfparser.c | 10 +++++----- usual/cxalloc.c | 10 +++++----- usual/cxextra.c | 28 ++++++++++++++-------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/usual/cfparser.c b/usual/cfparser.c index 5c5db91..ff9f4e5 100644 --- a/usual/cfparser.c +++ b/usual/cfparser.c @@ -332,12 +332,12 @@ static bool load_handler(void *arg, bool is_sect, const char *key, const char *v bool cf_load_file(const struct CfContext *cf, const char *fn) { - struct LoaderCtx ctx = { - .cf = cf, - .cur_sect = NULL, - }; + struct LoaderCtx ctx; + bool ok; + memset(&ctx, 0, sizeof(ctx)); + ctx.cf = cf; - bool ok = parse_ini_file(fn, load_handler, &ctx); + ok = parse_ini_file(fn, load_handler, &ctx); if (ctx.cur_sect) free(ctx.cur_sect); return ok; diff --git a/usual/cxalloc.c b/usual/cxalloc.c index 94d4921..3651fa1 100644 --- a/usual/cxalloc.c +++ b/usual/cxalloc.c @@ -99,14 +99,14 @@ static void libc_free(void *ctx, const void *ptr) } static const struct CxOps libc_alloc_ops = { - .c_alloc = libc_alloc, - .c_realloc = libc_realloc, - .c_free = libc_free, + libc_alloc, + libc_realloc, + libc_free, }; const struct CxMem cx_libc_allocator = { - .ops = &libc_alloc_ops, - .ctx = NULL, + &libc_alloc_ops, + NULL, }; diff --git a/usual/cxextra.c b/usual/cxextra.c index f2fe3b8..14e7ef9 100644 --- a/usual/cxextra.c +++ b/usual/cxextra.c @@ -49,15 +49,15 @@ static void nofail_destroy(void *next) } const struct CxOps cx_nofail_ops = { - .c_alloc = nofail_alloc, - .c_realloc = nofail_realloc, - .c_free = nofail_free, - .c_destroy = nofail_destroy, + nofail_alloc, + nofail_realloc, + nofail_free, + nofail_destroy, }; const struct CxMem cx_libc_nofail = { - .ops = &cx_nofail_ops, - .ctx = (void*)&cx_libc_allocator, + &cx_nofail_ops, + (void*)&cx_libc_allocator, }; /* @@ -164,10 +164,10 @@ static void pool_destroy(void *ctx) } static const struct CxOps pool_ops = { - .c_alloc = pool_alloc, - .c_realloc = pool_realloc, - .c_free = pool_free, - .c_destroy = pool_destroy, + pool_alloc, + pool_realloc, + pool_free, + pool_destroy, }; /* @@ -275,10 +275,10 @@ static void tree_destroy(void *ctx) } static const struct CxOps tree_ops = { - .c_alloc = tree_alloc, - .c_realloc = tree_realloc, - .c_free = tree_free, - .c_destroy = tree_destroy, + tree_alloc, + tree_realloc, + tree_free, + tree_destroy, }; -- 2.39.5