You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ge...@apache.org on 2010/05/10 18:11:05 UTC

svn commit: r942808 - in /trafficserver/traffic/trunk/example: query_remap/query_remap.c remap/remap.cc

Author: georgep
Date: Mon May 10 16:11:05 2010
New Revision: 942808

URL: http://svn.apache.org/viewvc?rev=942808&view=rev
Log:
TS-328: Fix examples compilation on FreeBSD(7.2) and OpenSolaris(osol0906)

Modified:
    trafficserver/traffic/trunk/example/query_remap/query_remap.c
    trafficserver/traffic/trunk/example/remap/remap.cc

Modified: trafficserver/traffic/trunk/example/query_remap/query_remap.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/query_remap/query_remap.c?rev=942808&r1=942807&r2=942808&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/query_remap/query_remap.c (original)
+++ trafficserver/traffic/trunk/example/query_remap/query_remap.c Mon May 10 16:11:05 2010
@@ -25,11 +25,12 @@
 #include <ts/ts.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdint.h>
 
 #define PLUGIN_NAME "query_remap"
 
 //function prototypes
-u_int32_t hash_fnv32(char *buf, size_t len);
+uint32_t hash_fnv32(char *buf, size_t len);
 
 typedef struct _query_remap_info {
   char *param_name;
@@ -134,7 +135,7 @@ int tsremap_remap(ihandle ih, rhandle rh
         ++val;
         //the param key matched the configured param_name
         //hash the param value to pick a host
-        hostidx = hash_fnv32(val, strlen(val)) % (u_int32_t)qri->num_hosts;
+        hostidx = hash_fnv32(val, strlen(val)) % (uint32_t)qri->num_hosts;
         INKDebug(PLUGIN_NAME, "modifying host based on %s", key);
         break;
       }
@@ -164,14 +165,14 @@ int tsremap_remap(ihandle ih, rhandle rh
 
 // FNV (Fowler/Noll/Vo) hash
 // (description: http://www.isthe.com/chongo/tech/comp/fnv/index.html)
-u_int32_t 
+uint32_t 
 hash_fnv32(char *buf, size_t len)
 {
-  u_int32_t hval = (u_int32_t)0x811c9dc5; //FNV1_32_INIT
+  uint32_t hval = (uint32_t)0x811c9dc5; //FNV1_32_INIT
 
   for (; len > 0; --len) {
-    hval *= (u_int32_t)0x01000193; //FNV_32_PRIME
-    hval ^= (u_int32_t)*buf++;
+    hval *= (uint32_t)0x01000193; //FNV_32_PRIME
+    hval ^= (uint32_t)*buf++;
   }
 
   return hval;

Modified: trafficserver/traffic/trunk/example/remap/remap.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/remap/remap.cc?rev=942808&r1=942807&r2=942808&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/remap/remap.cc (original)
+++ trafficserver/traffic/trunk/example/remap/remap.cc Mon May 10 16:11:05 2010
@@ -36,7 +36,6 @@
 #include <pthread.h>
 #include <unistd.h>
 #include <dlfcn.h>
-#include <malloc.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>