From b10e9943ce667a7494bf39d328ce234fc84f9f32 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Fri, 17 Feb 2012 20:53:36 +0000 Subject: [PATCH] Eina: remove ugly FMT_* compatibility strings as Evil has now POSIX printf family functions SVN revision: 68087 --- legacy/eina/src/lib/eina_magic.c | 5 ----- legacy/eina/src/lib/eina_model.c | 10 +++++----- legacy/eina/src/lib/eina_private.h | 14 -------------- legacy/eina/src/lib/eina_stringshare.c | 5 +---- legacy/eina/src/lib/eina_value.c | 24 ++++++++++++++---------- 5 files changed, 20 insertions(+), 38 deletions(-) diff --git a/legacy/eina/src/lib/eina_magic.c b/legacy/eina/src/lib/eina_magic.c index d1f71ccaf0..a42db2d643 100644 --- a/legacy/eina/src/lib/eina_magic.c +++ b/legacy/eina/src/lib/eina_magic.c @@ -102,13 +102,8 @@ _eina_magic_strings_alloc(void) tmp = realloc(_eina_magic_strings, sizeof(Eina_Magic_String) * size); if (!tmp) { -#ifdef _WIN32 - ERR("could not realloc magic_strings from %Iu to %Iu buckets.", - _eina_magic_strings_allocated, size); -#else ERR("could not realloc magic_strings from %zu to %zu buckets.", _eina_magic_strings_allocated, size); -#endif return NULL; } diff --git a/legacy/eina/src/lib/eina_model.c b/legacy/eina/src/lib/eina_model.c index 8af7a07143..51b8079daf 100644 --- a/legacy/eina/src/lib/eina_model.c +++ b/legacy/eina/src/lib/eina_model.c @@ -3278,7 +3278,7 @@ _eina_model_free(Eina_Model *model) const Eina_Model_Description *desc = model->desc; unsigned int i; - DBG("model %p (%s) refcount=%d deleted=" FMT_UCHAR, + DBG("model %p (%s) refcount=%d deleted=%hhu", model, model->desc->cache.types[0]->name, model->refcount, model->deleted); @@ -3358,7 +3358,7 @@ _eina_model_del(Eina_Model *model) { const Eina_Model_Description *desc = model->desc; - DBG("model %p (%s) refcount=%d deleted=" FMT_UCHAR, + DBG("model %p (%s) refcount=%d deleted=%hhu", model, model->desc->cache.types[0]->name, model->refcount, model->deleted); @@ -3375,7 +3375,7 @@ _eina_model_del(Eina_Model *model) static void _eina_model_unref(Eina_Model *model) { - DBG("model %p (%s) refcount=%d deleted=" FMT_UCHAR, + DBG("model %p (%s) refcount=%d deleted=%hhu", model, model->desc->cache.types[0]->name, model->refcount, model->deleted); @@ -3562,7 +3562,7 @@ EAPI Eina_Model * eina_model_ref(Eina_Model *model) { EINA_MODEL_INSTANCE_CHECK_VAL(model, NULL); - DBG("model %p (%s) refcount=%d deleted=" FMT_UCHAR, + DBG("model %p (%s) refcount=%d deleted=%hhu", model, model->desc->cache.types[0]->name, model->refcount, model->deleted); model->refcount++; @@ -3607,7 +3607,7 @@ EAPI Eina_Model * eina_model_xref(Eina_Model *model, const void *id, const char *label) { EINA_MODEL_INSTANCE_CHECK_VAL(model, NULL); - DBG("model %p (%s) refcount=%d deleted=" FMT_UCHAR" id=%p label=%s", + DBG("model %p (%s) refcount=%d deleted=%hhu id=%p label=%s", model, model->desc->cache.types[0]->name, model->refcount, model->deleted, id, label ? label : ""); diff --git a/legacy/eina/src/lib/eina_private.h b/legacy/eina/src/lib/eina_private.h index 840da7d64c..49df565780 100644 --- a/legacy/eina/src/lib/eina_private.h +++ b/legacy/eina/src/lib/eina_private.h @@ -42,20 +42,6 @@ max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x))) #endif -#ifdef _WIN32 -# define FMT_CHAR "%c" -# define FMT_UCHAR "%c" -# define FMT_XCHAR "%c" -# define FMT_OCHAR "%c" -# define FMT_2XCHAR "%2c" -#else -# define FMT_CHAR "%hhd" -# define FMT_UCHAR "%hhu" -# define FMT_XCHAR "%hhx" -# define FMT_OCHAR "%hho" -# define FMT_2XCHAR "%02hhx" -#endif - #define EINA_INLIST_JUMP_SIZE 256 #define READBUFSIZ 65536 diff --git a/legacy/eina/src/lib/eina_stringshare.c b/legacy/eina/src/lib/eina_stringshare.c index fe35954be9..f371fcdd95 100644 --- a/legacy/eina/src/lib/eina_stringshare.c +++ b/legacy/eina/src/lib/eina_stringshare.c @@ -465,11 +465,8 @@ _eina_stringshare_small_bucket_dump(Eina_Stringshare_Small_Bucket *bucket, for (i = 0; i < bucket->count; i++, s++, l++, r++) { int dups; -#ifdef _WIN32 - printf("DDD: %5hu %5hu '%s'\n", *l, *r, *s); -#else + printf("DDD: %5hhu %5hu '%s'\n", *l, *r, *s); -#endif dups = (*r - 1); diff --git a/legacy/eina/src/lib/eina_value.c b/legacy/eina/src/lib/eina_value.c index 8458afdb23..b8df69362e 100644 --- a/legacy/eina/src/lib/eina_value.c +++ b/legacy/eina/src/lib/eina_value.c @@ -49,6 +49,10 @@ void *alloca (size_t); #include /* PRId64 and PRIu64 */ #include /* struct timeval */ +#ifdef HAVE_EVIL +# include +#endif + #include "eina_config.h" #include "eina_private.h" #include "eina_error.h" @@ -221,7 +225,7 @@ _eina_value_type_uchar_convert_to(const Eina_Value_Type *type __UNUSED__, const { const char *other_mem; char buf[64]; - snprintf(buf, sizeof(buf), FMT_UCHAR , v); + snprintf(buf, sizeof(buf), "%hhu", v); other_mem = buf; /* required due &buf == buf */ return eina_value_type_pset(convert, convert_mem, &other_mem); } @@ -1005,7 +1009,7 @@ _eina_value_type_char_convert_to(const Eina_Value_Type *type __UNUSED__, const E { const char *other_mem; char buf[64]; - snprintf(buf, sizeof(buf), FMT_CHAR, v); + snprintf(buf, sizeof(buf), "%hhd", v); other_mem = buf; /* required due &buf == buf */ return eina_value_type_pset(convert, convert_mem, &other_mem); } @@ -2123,9 +2127,9 @@ _eina_value_type_string_common_convert_to(const Eina_Value_Type *type __UNUSED__ if (convert == EINA_VALUE_TYPE_UCHAR) { unsigned char other_mem; - if ((sscanf(v, FMT_UCHAR, &other_mem) != 1) && - (sscanf(v, FMT_XCHAR, &other_mem) != 1) && - (sscanf(v, FMT_OCHAR, &other_mem) != 1)) + if ((sscanf(v, "%hhu", &other_mem) != 1) && + (sscanf(v, "%hhx", &other_mem) != 1) && + (sscanf(v, "%hho", &other_mem) != 1)) return EINA_FALSE; return eina_value_type_pset(convert, convert_mem, &other_mem); } @@ -2168,9 +2172,9 @@ _eina_value_type_string_common_convert_to(const Eina_Value_Type *type __UNUSED__ else if (convert == EINA_VALUE_TYPE_CHAR) { char other_mem; - if ((sscanf(v, FMT_CHAR, &other_mem) != 1) && - (sscanf(v, FMT_XCHAR, &other_mem) != 1) && - (sscanf(v, FMT_OCHAR, &other_mem) != 1)) + if ((sscanf(v, "%hhd", &other_mem) != 1) && + (sscanf(v, "%hhx", &other_mem) != 1) && + (sscanf(v, "%hho", &other_mem) != 1)) return EINA_FALSE; return eina_value_type_pset(convert, convert_mem, &other_mem); } @@ -3719,12 +3723,12 @@ _eina_value_type_blob_convert_to(const Eina_Value_Type *type __UNUSED__, const E if (first) { first = EINA_FALSE; - if (!eina_strbuf_append_printf(str, FMT_2XCHAR, *ptr)) + if (!eina_strbuf_append_printf(str, "%02hhx", *ptr)) goto error; } else { - if (!eina_strbuf_append_printf(str, " " FMT_2XCHAR, *ptr)) + if (!eina_strbuf_append_printf(str, " %02hhx", *ptr)) goto error; } }