* eina: Allow compilation with -Wshadow.
authorcedric <cedric>
Sat, 23 Jan 2010 19:53:27 +0000 (19:53 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 23 Jan 2010 19:53:27 +0000 (19:53 +0000)
Patch from Albin Tonerre.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@45497 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/include/eina_array.h
src/include/eina_inline_array.x
src/lib/eina_array.c
src/lib/eina_counter.c
src/lib/eina_cpu.c
src/lib/eina_list.c
src/lib/eina_module.c
src/lib/eina_stringshare.c
src/modules/mp/fixed_bitmap/eina_fixed_bitmap.c

index c1988ae..1e7918e 100644 (file)
@@ -82,8 +82,8 @@ EAPI Eina_Bool    eina_array_remove   (Eina_Array *array, Eina_Bool (*keep)(void
 
 static inline Eina_Bool     eina_array_push  (Eina_Array *array, const void *data) EINA_ARG_NONNULL(1, 2);
 static inline void         *eina_array_pop   (Eina_Array *array) EINA_ARG_NONNULL(1);
-static inline void         *eina_array_data_get (const Eina_Array *array, unsigned int index) EINA_ARG_NONNULL(1) EINA_PURE;
-static inline void          eina_array_data_set (const Eina_Array *array, unsigned int index, const void *data) EINA_ARG_NONNULL(1, 3);
+static inline void         *eina_array_data_get (const Eina_Array *array, unsigned int idx) EINA_ARG_NONNULL(1) EINA_PURE;
+static inline void          eina_array_data_set (const Eina_Array *array, unsigned int idx, const void *data) EINA_ARG_NONNULL(1, 3);
 static inline unsigned int  eina_array_count_get (const Eina_Array *array) EINA_ARG_NONNULL(1) EINA_PURE;
 
 EAPI Eina_Iterator *eina_array_iterator_new (const Eina_Array *array) EINA_MALLOC EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
index 1a2dc31..400da23 100644 (file)
@@ -87,34 +87,34 @@ eina_array_pop(Eina_Array *array)
  * @brief Return the data at a given position in an array.
  *
  * @param array The array.
- * @param index The potition of the data to retrieve.
+ * @param idx The potition of the data to retrieve.
  * @return The retrieved data.
  *
- * This function returns the data at the position @p index in @p
+ * This function returns the data at the position @p idx in @p
  * array. For performance reasons, there is no check of @p array or @p
- * index. If it is @c NULL or invalid, the program may crash.
+ * idx. If it is @c NULL or invalid, the program may crash.
  */
 static inline void *
-eina_array_data_get(const Eina_Array *array, unsigned int index)
+eina_array_data_get(const Eina_Array *array, unsigned int idx)
 {
-   return array->data[index];
+   return array->data[idx];
 }
 
 /**
  * @brief Return the data at a given position in an array.
  *
  * @param array The array.
- * @param index The potition of the data to set.
+ * @param idx The potition of the data to set.
  * @param data The data to set.
  *
- * This function returns the data at the position @p index in @p
+ * This function returns the data at the position @p idx in @p
  * array. For performance reasons, there is no check of @p array or @p
- * index. If it is @c NULL or invalid, the program may crash.
+ * idx. If it is @c NULL or invalid, the program may crash.
  */
 static inline void
-eina_array_data_set(const Eina_Array *array, unsigned int index, const void *data)
+eina_array_data_set(const Eina_Array *array, unsigned int idx, const void *data)
 {
-   array->data[index] = (void*) data;
+   array->data[idx] = (void*) data;
 }
 
 /**
index f03e29d..b32349a 100644 (file)
@@ -198,7 +198,7 @@ static void eina_array_iterator_free(Eina_Iterator_Array *it) EINA_ARG_NONNULL(1
 static Eina_Array *eina_array_iterator_get_container(Eina_Iterator_Array *it) EINA_ARG_NONNULL(1);
 static Eina_Bool eina_array_iterator_next(Eina_Iterator_Array *it, void **data) EINA_ARG_NONNULL(1);
 
-static Eina_Bool eina_array_accessor_get_at(Eina_Accessor_Array *it, unsigned int index, void **data) EINA_ARG_NONNULL(1);
+static Eina_Bool eina_array_accessor_get_at(Eina_Accessor_Array *it, unsigned int idx, void **data) EINA_ARG_NONNULL(1);
 static Eina_Array *eina_array_accessor_get_container(Eina_Accessor_Array *it) EINA_ARG_NONNULL(1);
 static void eina_array_accessor_free(Eina_Accessor_Array *it) EINA_ARG_NONNULL(1);
 
@@ -230,14 +230,14 @@ eina_array_iterator_free(Eina_Iterator_Array *it)
 }
 
 static Eina_Bool
-eina_array_accessor_get_at(Eina_Accessor_Array *it, unsigned int index, void **data)
+eina_array_accessor_get_at(Eina_Accessor_Array *it, unsigned int idx, void **data)
 {
    EINA_MAGIC_CHECK_ARRAY_ACCESSOR(it, EINA_FALSE);
 
-   if (!(index < eina_array_count_get(it->array)))
+   if (!(idx < eina_array_count_get(it->array)))
      return EINA_FALSE;
    if (data)
-     *data = eina_array_data_get(it->array, index);
+     *data = eina_array_data_get(it->array, idx);
    return EINA_TRUE;
 }
 
index 9dabf90..e2284e1 100644 (file)
@@ -331,10 +331,10 @@ eina_counter_free(Eina_Counter *counter)
 
    while (counter->clocks)
      {
-       Eina_Clock *clock = (Eina_Clock *) counter->clocks;
+       Eina_Clock *clk = (Eina_Clock *) counter->clocks;
 
        counter->clocks = eina_inlist_remove(counter->clocks, counter->clocks);
-       free(clock);
+       free(clk);
      }
 
    free(counter);
index 3b93a4a..8ddbd0a 100644 (file)
@@ -72,6 +72,7 @@ static inline void _x86_cpuid(int op, int *a, int *b, int *c, int *d)
                : "cc");
 }
 
+static
 void _x86_simd(Eina_Cpu_Features *features)
 {
        int a, b, c, d;
index b6651c6..c087d43 100644 (file)
@@ -307,7 +307,7 @@ eina_list_iterator_free(Eina_Iterator_List *it)
 }
 
 static Eina_Bool
-eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int index, void **data)
+eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int idx, void **data)
 {
    const Eina_List *over;
    unsigned int middle;
@@ -315,22 +315,22 @@ eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int index, void **dat
 
    EINA_MAGIC_CHECK_LIST_ACCESSOR(it, EINA_FALSE);
 
-   if (index >= eina_list_count(it->head)) return EINA_FALSE;
+   if (idx >= eina_list_count(it->head)) return EINA_FALSE;
 
-   if (it->index == index)
+   if (it->index == idx)
      {
        over = it->current;
      }
-   else if (index > it->index)
+   else if (idx > it->index)
      {
        /* After current position. */
        middle = ((eina_list_count(it->head) - it->index) >> 1) + it->index;
 
-       if (index > middle)
+       if (idx > middle)
          {
             /* Go backward from the end. */
             for (i = eina_list_count(it->head) - 1, over = eina_list_last(it->head);
-                 i > index && over != NULL;
+                 i > idx && over != NULL;
                  --i, over = eina_list_prev(over))
               ;
          }
@@ -338,7 +338,7 @@ eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int index, void **dat
          {
             /* Go forward from current. */
             for (i = it->index, over = it->current;
-                 i < index && over != NULL;
+                 i < idx && over != NULL;
                  ++i, over = eina_list_next(over))
               ;
          }
@@ -348,11 +348,11 @@ eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int index, void **dat
        /* Before current position. */
        middle = it->index >> 1;
 
-       if (index > middle)
+       if (idx > middle)
          {
             /* Go backward from current. */
             for (i = it->index, over = it->current;
-                 i > index && over != NULL;
+                 i > idx && over != NULL;
                  --i, over = eina_list_prev(over))
               ;
          }
@@ -360,7 +360,7 @@ eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int index, void **dat
          {
             /* Go forward from start. */
             for (i = 0, over = it->head;
-                 i < index && over != NULL;
+                 i < idx && over != NULL;
                  ++i, over = eina_list_next(over))
               ;
          }
@@ -369,7 +369,7 @@ eina_list_accessor_get_at(Eina_Accessor_List *it, unsigned int index, void **dat
    if (over == NULL) return EINA_FALSE;
 
    it->current = over;
-   it->index = index;
+   it->index = idx;
 
    *data = eina_list_data_get(it->current);
    return EINA_TRUE;
index 5621789..5d2e007 100644 (file)
@@ -139,7 +139,6 @@ static void _dir_list_cb(const char *name, const char *path, void *data)
      {
        char *file;
        Eina_Module *m;
-       size_t length;
 
        length = strlen(path) + strlen(name) + 2;
 
index 59ce9f1..afc1df1 100644 (file)
@@ -445,7 +445,7 @@ _eina_stringshare_small_cmp(const Eina_Stringshare_Small_Bucket *bucket, int i,
 }
 
 static const char *
-_eina_stringshare_small_bucket_find(const Eina_Stringshare_Small_Bucket *bucket, const char *str, unsigned char length, int *index)
+_eina_stringshare_small_bucket_find(const Eina_Stringshare_Small_Bucket *bucket, const char *str, unsigned char length, int *idx)
 {
    const char *pstr = str + 1; /* skip first letter, it's always the same */
    unsigned char plength = length - 1;
@@ -453,7 +453,7 @@ _eina_stringshare_small_bucket_find(const Eina_Stringshare_Small_Bucket *bucket,
 
    if (bucket->count == 0)
      {
-       *index = 0;
+       *idx = 0;
        return NULL;
      }
 
@@ -477,12 +477,12 @@ _eina_stringshare_small_bucket_find(const Eina_Stringshare_Small_Bucket *bucket,
          }
        else
          {
-            *index = i;
+            *idx = i;
             return bucket->strings[i];
          }
      }
 
-   *index = low;
+   *idx = low;
    return NULL;
 }
 
@@ -520,7 +520,7 @@ _eina_stringshare_small_bucket_resize(Eina_Stringshare_Small_Bucket *bucket, int
 }
 
 static const char *
-_eina_stringshare_small_bucket_insert_at(Eina_Stringshare_Small_Bucket **p_bucket, const char *str, unsigned char length, int index)
+_eina_stringshare_small_bucket_insert_at(Eina_Stringshare_Small_Bucket **p_bucket, const char *str, unsigned char length, int idx)
 {
    Eina_Stringshare_Small_Bucket *bucket = *p_bucket;
    int todo, off;
@@ -552,39 +552,39 @@ _eina_stringshare_small_bucket_insert_at(Eina_Stringshare_Small_Bucket **p_bucke
    memcpy(snew, str, length);
    snew[length] = '\0';
 
-   off = index + 1;
-   todo = bucket->count - index;
+   off = idx + 1;
+   todo = bucket->count - idx;
    if (todo > 0)
      {
-       memmove((void *)(bucket->strings + off), bucket->strings + index,
+       memmove((void *)(bucket->strings + off), bucket->strings + idx,
                todo * sizeof(bucket->strings[0]));
-       memmove(bucket->lengths + off, bucket->lengths + index,
+       memmove(bucket->lengths + off, bucket->lengths + idx,
                todo * sizeof(bucket->lengths[0]));
-       memmove(bucket->references + off, bucket->references + index,
+       memmove(bucket->references + off, bucket->references + idx,
                todo * sizeof(bucket->references[0]));
      }
 
-   bucket->strings[index] = snew;
-   bucket->lengths[index] = length;
-   bucket->references[index] = 1;
+   bucket->strings[idx] = snew;
+   bucket->lengths[idx] = length;
+   bucket->references[idx] = 1;
    bucket->count++;
 
    return snew;
 }
 
 static void
-_eina_stringshare_small_bucket_remove_at(Eina_Stringshare_Small_Bucket **p_bucket, int index)
+_eina_stringshare_small_bucket_remove_at(Eina_Stringshare_Small_Bucket **p_bucket, int idx)
 {
    Eina_Stringshare_Small_Bucket *bucket = *p_bucket;
    int todo, off;
 
-   if (bucket->references[index] > 1)
+   if (bucket->references[idx] > 1)
      {
-       bucket->references[index]--;
+       bucket->references[idx]--;
        return;
      }
 
-   free((char *)bucket->strings[index]);
+   free((char *)bucket->strings[idx]);
 
    if (bucket->count == 1)
      {
@@ -597,17 +597,17 @@ _eina_stringshare_small_bucket_remove_at(Eina_Stringshare_Small_Bucket **p_bucke
      }
 
    bucket->count--;
-   if (index == bucket->count)
+   if (idx == bucket->count)
      goto end;
 
-   off = index + 1;
-   todo = bucket->count - index;
+   off = idx + 1;
+   todo = bucket->count - idx;
 
-   memmove((void *)(bucket->strings + index), bucket->strings + off,
+   memmove((void *)(bucket->strings + idx), bucket->strings + off,
           todo * sizeof(bucket->strings[0]));
-   memmove(bucket->lengths + index, bucket->lengths + off,
+   memmove(bucket->lengths + idx, bucket->lengths + off,
           todo * sizeof(bucket->lengths[0]));
-   memmove(bucket->references + index, bucket->references + off,
+   memmove(bucket->references + idx, bucket->references + off,
           todo * sizeof(bucket->references[0]));
 
  end:
index f91840a..992935b 100644 (file)
@@ -108,7 +108,7 @@ eina_fixed_bitmap_malloc(void *data, __UNUSED__ unsigned int size)
    Eina_Fixed_Bitmap *mp = data;
    Eina_Fixed_Bitmap_Pool *pool = NULL;
    void *ptr;
-   int index;
+   int idx;
 
    if (mp->head)
      {
@@ -133,9 +133,9 @@ eina_fixed_bitmap_malloc(void *data, __UNUSED__ unsigned int size)
        mp->lookup = eina_rbtree_inline_insert(mp->lookup, EINA_RBTREE_GET(pool), EINA_RBTREE_CMP_NODE_CB(_eina_fixed_cmp), NULL);
      }
 
-   index = ffs(pool->bitmask) - 1;
-   pool->bitmask &= ~(1 << index);
-   ptr = (unsigned char*) (pool + 1) + index * mp->item_size;
+   idx = ffs(pool->bitmask) - 1;
+   pool->bitmask &= ~(1 << idx);
+   ptr = (unsigned char*) (pool + 1) + idx * mp->item_size;
 
    if (pool->bitmask == 0)
      mp->head = eina_inlist_demote(mp->head, EINA_INLIST_GET(pool));