trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject svn commit: r882750 - in /incubator/trafficserver/traffic/trunk/libinktomi++: ink_queue.cc ink_queue.h
Date Fri, 20 Nov 2009 22:45:02 GMT
Author: bcall
Date: Fri Nov 20 22:45:01 2009
New Revision: 882750

URL: http://svn.apache.org/viewvc?rev=882750&view=rev
Log:
TS-38 Patch from John Plevyak, fixes some warnings on Ubuntu 8.04 x86_64
with gcc 4.2.4

Modified:
    incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.cc
    incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.h

Modified: incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/libinktomi%2B%2B/ink_queue.cc?rev=882750&r1=882749&r2=882750&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.cc (original)
+++ incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.cc Fri Nov 20 22:45:01 2009
@@ -103,7 +103,7 @@
 
 void
 ink_freelist_init(InkFreeList * f,
-                  const char *name, unsigned type_size, unsigned chunk_size, unsigned offset,
unsigned alignment)
+                  const char *name, inku32 type_size, inku32 chunk_size, inku32 offset, inku32
alignment)
 {
   ink_freelist_list *fll;
 
@@ -133,7 +133,7 @@
   f->tail = NULL;
 #endif
 #else
-  SET_FREELIST_POINTER_VERSION(f->head, FROM_PTR(NULL), ((unsigned long) 0));
+  SET_FREELIST_POINTER_VERSION(f->head, FROM_PTR(NULL), 0);
 #endif
 
   f->count = 0;
@@ -143,7 +143,7 @@
 }
 
 InkFreeList *
-ink_freelist_create(const char *name, unsigned type_size, unsigned chunk_size, unsigned offset,
unsigned alignment)
+ink_freelist_create(const char *name, inku32 type_size, inku32 chunk_size, inku32 offset,
inku32 alignment)
 {
   InkFreeList *f = ink_type_malloc(InkFreeList);
   ink_freelist_init(f, name, type_size, chunk_size, offset, alignment);
@@ -165,12 +165,12 @@
 void *
 ink_freelist_new(InkFreeList * f)
 #endif                          /* !INK_USE_MUTEX_FOR_FREELISTS */
-{                               //static unsigned cntf = 0;
+{                               //static inku32 cntf = 0;
 
 
 #if (defined(USE_SPINLOCK_FOR_FREELIST) || defined(CHECK_FOR_DOUBLE_FREE))
   void *foo;
-  unsigned type_size = f->type_size;
+  inku32 type_size = f->type_size;
 
   ink_mutex_acquire(&(f->freelist_mutex));
   ink_assert(f->type_size != 0);
@@ -198,7 +198,7 @@
      * Might as well unlock the freelist mutex, since
      * we're just going to do a malloc now..
      */
-    unsigned alignment;
+    inku32 alignment;
 
 #ifdef MEMPROTECT
     if (type_size >= MEMPROTECT_SIZE) {
@@ -240,8 +240,8 @@
   do {
     INK_QUEUE_LD64(item, f->head);
     if (TO_PTR(FREELIST_POINTER(item)) == NULL) {
-      unsigned type_size = f->type_size;
-      unsigned int i;
+      inku32 type_size = f->type_size;
+      inku32 i;
 
 #ifdef MEMPROTECT
       if (type_size >= MEMPROTECT_SIZE) {
@@ -270,11 +270,11 @@
 #endif
       SET_FREELIST_POINTER_VERSION(item, newp, 0);
 #else
-      unsigned int add;
-      unsigned long mask;
+      uintptr_t add;
+      uintptr_t mask;
       if (f->alignment) {
         add = f->alignment - 1;
-        mask = ~(unsigned long) add;
+        mask = ~(uintptr_t) add;
       } else {
         add = 0;
         mask = ~0;
@@ -282,8 +282,8 @@
       newp = ink_malloc(f->chunk_size * type_size + add);
       if (newp)
         fl_memadd(f->chunk_size * type_size + add);
-      newp = (void *) ((((unsigned long) newp) + add) & mask);
-      SET_FREELIST_POINTER_VERSION(item, newp, ((unsigned long) 0));
+      newp = (void *) ((((uintptr_t) newp) + add) & mask);
+      SET_FREELIST_POINTER_VERSION(item, newp, 0);
 #endif
 
 #if !defined(INK_USE_MUTEX_FOR_FREELISTS)
@@ -344,7 +344,7 @@
     }
   }
   while (result == 0);
-  // ink_assert(!((unsigned long)TO_PTR(FREELIST_POINTER(item))&(f->alignment-1)));
XXX - why is this no longer working? -bcall
+  ink_assert(!((uintptr_t)TO_PTR(FREELIST_POINTER(item))&(((uintptr_t)f->alignment)-1)));
 
   ink_atomic_increment((int *) &f->count, 1);
   ink_atomic_increment64(&fastalloc_mem_in_use, (ink64) f->type_size);
@@ -435,9 +435,9 @@
     if (TO_PTR(FREELIST_POINTER(h)) == item)
       ink_fatal(1, "ink_freelist_free: trying to free item twice");
 #ifdef __alpha
-    if (((unsigned long) (TO_PTR(h.data))) & 3)
+    if (((uintptr_t) (TO_PTR(h.data))) & 3)
 #else
-    if (((unsigned long) (TO_PTR(h.s.pointer))) & 3)
+    if (((uintptr_t) (TO_PTR(h.s.pointer))) & 3)
 #endif
       ink_fatal(1, "ink_freelist_free: bad list");
     if (TO_PTR(FREELIST_POINTER(h)))
@@ -518,17 +518,17 @@
 
 
 #define INK_FREELIST_CREATE(T, n) \
-ink_freelist_create("<unknown>", sizeof(T), n, (unsigned)&((T *)0)->next, 4)
+ink_freelist_create("<unknown>", sizeof(T), n, (uintptr_t)&((T *)0)->next, 4)
 
 void
-ink_atomiclist_init(InkAtomicList * l, const char *name, unsigned offset_to_next)
+ink_atomiclist_init(InkAtomicList * l, const char *name, inku32 offset_to_next)
 {
 #if defined(INK_USE_MUTEX_FOR_ATOMICLISTS)
   ink_mutex_init(&(l->inkatomiclist_mutex), name);
 #endif
   l->name = name;
   l->offset = offset_to_next;
-  SET_FREELIST_POINTER_VERSION(l->head, FROM_PTR(NULL), ((unsigned long) 0));
+  SET_FREELIST_POINTER_VERSION(l->head, FROM_PTR(NULL), 0);
 }
 
 #if defined(INK_USE_MUTEX_FOR_ATOMICLISTS)

Modified: incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/libinktomi%2B%2B/ink_queue.h?rev=882750&r1=882749&r2=882750&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.h (original)
+++ incubator/trafficserver/traffic/trunk/libinktomi++/ink_queue.h Fri Nov 20 22:45:01 2009
@@ -92,11 +92,11 @@
 #define ZERO_HEAD_P(_x)
 
 #ifdef DEBUG
-#define FROM_PTR(_x) (void*)(((unsigned long)_x)+1)
-#define TO_PTR(_x) (void*)(((unsigned long)_x)-1)
+#define FROM_PTR(_x) (void*)(((uintptr_t)_x)+1)
+#define TO_PTR(_x) (void*)(((uintptr_t)_x)-1)
 #else
-#define FROM_PTR(_x) _x
-#define TO_PTR(_x) _x
+#define FROM_PTR(_x) ((void*)(_x))
+#define TO_PTR(_x) ((void*)(_x))
 #endif
 
 #if defined(__i386__)
@@ -135,24 +135,23 @@
 #endif
 
     const char *name;
-    unsigned type_size, chunk_size, count, allocated, offset, alignment;
-    unsigned allocated_base, count_base;
+    inku32 type_size, chunk_size, count, allocated, offset, alignment;
+    inku32 allocated_base, count_base;
   } InkFreeList, *PInkFreeList;
 
   inkcoreapi extern volatile ink64 fastalloc_mem_in_use;
   inkcoreapi extern volatile ink64 fastalloc_mem_total;
-
   inkcoreapi extern volatile ink64 freelist_allocated_mem;
 
 /*
  * alignment must be a power of 2
  */
-  InkFreeList *ink_freelist_create(const char *name, unsigned type_size,
-                                   unsigned chunk_size, unsigned offset_to_next, unsigned
alignment);
+  InkFreeList *ink_freelist_create(const char *name, inku32 type_size,
+                                   inku32 chunk_size, inku32 offset_to_next, inku32 alignment);
 
   inkcoreapi void ink_freelist_init(InkFreeList * fl, const char *name,
-                                    unsigned type_size, unsigned chunk_size,
-                                    unsigned offset_to_next, unsigned alignment);
+                                    inku32 type_size, inku32 chunk_size,
+                                    inku32 offset_to_next, inku32 alignment);
 #if !defined(INK_USE_MUTEX_FOR_FREELISTS)
   inkcoreapi void *ink_freelist_new(InkFreeList * f);
   inkcoreapi void ink_freelist_free(InkFreeList * f, void *item);
@@ -186,7 +185,7 @@
 #endif
     volatile head_p head;
     const char *name;
-    unsigned offset;
+    inku32 offset;
   } InkAtomicList;
 
 #if !defined(INK_QUEUE_NT)
@@ -196,7 +195,7 @@
 #define INK_ATOMICLIST_EMPTY(_x) (!(      (FREELIST_POINTER((_x.head)))))
 #endif
 
-  inkcoreapi void ink_atomiclist_init(InkAtomicList * l, const char *name, unsigned offset_to_next);
+  inkcoreapi void ink_atomiclist_init(InkAtomicList * l, const char *name, inku32 offset_to_next);
 #if !defined(INK_USE_MUTEX_FOR_ATOMICLISTS)
   inkcoreapi void *ink_atomiclist_push(InkAtomicList * l, void *item);
   void *ink_atomiclist_pop(InkAtomicList * l);



Mime
View raw message