Eina: remove ugly FMT_* compatibility strings as Evil has now POSIX printf family...
authorcaro <caro>
Fri, 17 Feb 2012 20:53:36 +0000 (20:53 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 17 Feb 2012 20:53:36 +0000 (20:53 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@68087 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/eina_magic.c
src/lib/eina_model.c
src/lib/eina_private.h
src/lib/eina_stringshare.c
src/lib/eina_value.c

index d1f71cc..a42db2d 100644 (file)
@@ -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;
           }
 
index 8af7a07..51b8079 100644 (file)
@@ -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 : "");
 
index 840da7d..49df565 100644 (file)
                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
index fe35954..f371fcd 100644 (file)
@@ -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);
 
index 8458afd..b8df693 100644 (file)
@@ -49,6 +49,10 @@ void *alloca (size_t);
 #include <inttypes.h> /* PRId64 and PRIu64 */
 #include <sys/time.h> /* struct timeval */
 
+#ifdef HAVE_EVIL
+# include <Evil.h>
+#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;
                }
           }