trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1072388 - in /trafficserver/traffic/trunk/proxy: InkAPI.cc InkAPITest.cc InkAPITestTool.cc api/ts/experimental.h api/ts/ts.h.in
Date Sat, 19 Feb 2011 16:57:20 GMT
Author: zwoop
Date: Sat Feb 19 16:57:20 2011
New Revision: 1072388

URL: http://svn.apache.org/viewvc?rev=1072388&view=rev
Log:
TS-590 Change the last int-as-boolean return types to use TSReturnCode

Modified:
    trafficserver/traffic/trunk/proxy/InkAPI.cc
    trafficserver/traffic/trunk/proxy/InkAPITest.cc
    trafficserver/traffic/trunk/proxy/InkAPITestTool.cc
    trafficserver/traffic/trunk/proxy/api/ts/experimental.h
    trafficserver/traffic/trunk/proxy/api/ts/ts.h.in

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1072388&r1=1072387&r2=1072388&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Sat Feb 19 16:57:20 2011
@@ -4016,25 +4016,25 @@ TSConfigDataGet(TSConfig configp)
 // Management
 //
 ////////////////////////////////////////////////////////////////////
-int
+TSReturnCode
 TSMgmtIntGet(const char *var_name, TSMgmtInt *result)
 {
-  return RecGetRecordInt((char *) var_name, (RecInt *) result) == REC_ERR_OKAY ? 1 : 0;
+  return RecGetRecordInt((char *) var_name, (RecInt *) result) == REC_ERR_OKAY ? TS_SUCCESS
: TS_ERROR;
 }
 
-int
+TSReturnCode
 TSMgmtCounterGet(const char *var_name, TSMgmtCounter *result)
 {
-  return RecGetRecordCounter((char *) var_name, (RecCounter *) result) == REC_ERR_OKAY ?
1 : 0;
+  return RecGetRecordCounter((char *) var_name, (RecCounter *) result) == REC_ERR_OKAY ?
TS_SUCCESS : TS_ERROR;
 }
 
-int
+TSReturnCode
 TSMgmtFloatGet(const char *var_name, TSMgmtFloat *result)
 {
-  return RecGetRecordFloat((char *) var_name, (RecFloat *) result) == REC_ERR_OKAY ? 1 :
0;
+  return RecGetRecordFloat((char *) var_name, (RecFloat *) result) == REC_ERR_OKAY ? TS_SUCCESS
: TS_ERROR;
 }
 
-int
+TSReturnCode
 TSMgmtStringGet(const char *var_name, TSMgmtString *result)
 {
   RecString tmp = 0;
@@ -4042,9 +4042,10 @@ TSMgmtStringGet(const char *var_name, TS
 
   if (tmp) {
     *result = tmp;
-    return 1;
+    return TS_SUCCESS;
   }
-  return 0;
+
+  return TS_ERROR;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -4332,7 +4333,7 @@ TSHttpTxnHookAdd(TSHttpTxn txnp, TSHttpH
 
 // Private api function for gzip plugin.
 //  This function should only appear in TsapiPrivate.h
-int
+TSReturnCode
 TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc funcp)
 {
   HttpSM *sm = (HttpSM *) txnp;
@@ -4340,12 +4341,12 @@ TSHttpTxnHookRegisteredFor(TSHttpTxn txn
 
   while (hook != NULL) {
     if (hook->m_cont && hook->m_cont->m_event_func == funcp) {
-      return 1;
+      return TS_SUCCESS;
     }
     hook = hook->m_link.next;
   }
 
-  return 0;
+  return TS_ERROR;
 }
 
 TSHttpSsn
@@ -5393,7 +5394,7 @@ TSHttpTxnSetHttpRetBody(TSHttpTxn txnp, 
 }
 
 /* control channel for HTTP */
-int
+TSReturnCode
 TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data)
 {
   sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
@@ -5403,9 +5404,8 @@ TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntl
   switch (cntl) {
   case TS_HTTP_CNTL_GET_LOGGING_MODE:
     {
-      if (data == NULL) {
-        return 0;
-      }
+      if (data == NULL)
+        return TS_ERROR;
 
       intptr_t *rptr = (intptr_t *) data;
 
@@ -5415,23 +5415,22 @@ TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntl
         *rptr = (intptr_t) TS_HTTP_CNTL_OFF;
       }
 
-      return 1;
+      return TS_SUCCESS;
     }
 
   case TS_HTTP_CNTL_SET_LOGGING_MODE:
     if (data != TS_HTTP_CNTL_ON && data != TS_HTTP_CNTL_OFF) {
-      return 0;
+      return TS_ERROR;
     } else {
       sm->t_state.api_info.logging_enabled = (bool) data;
-      return 1;
+      return TS_SUCCESS;
     }
     break;
 
   case TS_HTTP_CNTL_GET_INTERCEPT_RETRY_MODE:
     {
-      if (data == NULL) {
-        return 0;
-      }
+      if (data == NULL)
+        return TS_ERROR;
 
       intptr_t *rptr = (intptr_t *) data;
 
@@ -5441,21 +5440,21 @@ TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntl
         *rptr = (intptr_t) TS_HTTP_CNTL_OFF;
       }
 
-      return 1;
+      return TS_SUCCESS;
     }
 
   case TS_HTTP_CNTL_SET_INTERCEPT_RETRY_MODE:
     if (data != TS_HTTP_CNTL_ON && data != TS_HTTP_CNTL_OFF) {
-      return 0;
+      return TS_ERROR;
     } else {
       sm->t_state.api_info.retry_intercept_failures = (bool) data;
-      return 1;
+      return TS_SUCCESS;
     }
   default:
-    return 0;
+    return TS_ERROR;
   }
 
-  return 0;
+  return TS_ERROR;
 }
 
 /* This is kinda horky, we have to use TSServerState instead of
@@ -6647,27 +6646,27 @@ TSIPLookupMatch(TSIPLookup iplu, uint32_
   return (my_iplu ? my_iplu->Match((ip_addr_t) addr, data) : 0);
 }
 
-int
+TSReturnCode
 TSIPLookupMatchFirst(TSIPLookup iplu, uint32_t addr, TSIPLookupState iplus, void **data)
 {
   IpLookup *my_iplu = (IpLookup *) iplu;
   IpLookupState *my_iplus = (IpLookupState *) iplus;
   if (my_iplu && my_iplus && my_iplu->MatchFirst(addr, my_iplus, data))
-    return 1;
+    return TS_SUCCESS;
 
-  return 0;
+  return TS_ERROR;
 }
 
-int
+TSReturnCode
 TSIPLookupMatchNext(TSIPLookup iplu, TSIPLookupState iplus, void **data)
 {
   IpLookup *my_iplu = (IpLookup *) iplu;
   IpLookupState *my_iplus = (IpLookupState *) iplus;
 
   if (my_iplu && my_iplus && my_iplu->MatchNext(my_iplus, data))
-    return 1;
+    return TS_SUCCESS;
 
-  return 0;
+  return TS_ERROR;
 }
 
 void
@@ -6744,7 +6743,7 @@ TSMgmtConfigIntSet(const char *var_name,
   char *buffer;
 
   // is this a valid integer?
-  if (!TSMgmtIntGet(var_name, &result))
+  if (TSMgmtIntGet(var_name, &result) != TS_SUCCESS)
     return TS_ERROR;
 
   // construct a buffer
@@ -6991,7 +6990,7 @@ TSFetchUrl(const char* headers, int requ
   fetch_sm->httpConnect();
 }
 
-int
+TSReturnCode
 TSHttpIsInternalRequest(TSHttpTxn txnp)
 {
   sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
@@ -7001,9 +7000,9 @@ TSHttpIsInternalRequest(TSHttpTxn txnp)
   NetVConnection *vc = cs->get_netvc();
 
   if (!cs || !vc)
-    return 0;
+    return TS_ERROR;
 
-  return vc->get_is_internal_request() ? 1 : 0;
+  return vc->get_is_internal_request() ? TS_SUCCESS : TS_ERROR;
 }
 
 

Modified: trafficserver/traffic/trunk/proxy/InkAPITest.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITest.cc?rev=1072388&r1=1072387&r2=1072388&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITest.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITest.cc Sat Feb 19 16:57:20 2011
@@ -2252,7 +2252,7 @@ checkHttpTxnClientIncomingPortGet(Socket
     return TS_EVENT_CONTINUE;
   }
 
-  if (TSMgmtIntGet("proxy.config.http.server_port", &port_from_config_file) == 0) {
+  if (TSMgmtIntGet("proxy.config.http.server_port", &port_from_config_file) != TS_SUCCESS)
{
     port_from_config_file = 8080;
   }
 
@@ -5545,15 +5545,13 @@ REGRESSION_TEST(SDK_API_TSMgmtGet) (Regr
 
   *pstatus = REGRESSION_TEST_INPROGRESS;
 
-  int retVal;
   int err = 0;
   TSMgmtCounter cvalue = 0;
   TSMgmtFloat fvalue = 0.0;
   TSMgmtInt ivalue = -1;
   TSMgmtString svalue = NULL;
 
-  retVal = TSMgmtCounterGet(CONFIG_PARAM_COUNTER_NAME, &cvalue);
-  if (retVal == 0) {
+  if (TS_SUCCESS != TSMgmtCounterGet(CONFIG_PARAM_COUNTER_NAME, &cvalue)) {
     SDK_RPRINT(test, "TSMgmtCounterGet", "TestCase1.1", TC_FAIL, "can not get value of param
%s", CONFIG_PARAM_COUNTER_NAME);
     err = 1;
   } else if (cvalue != CONFIG_PARAM_COUNTER_VALUE) {
@@ -5565,24 +5563,21 @@ REGRESSION_TEST(SDK_API_TSMgmtGet) (Regr
     SDK_RPRINT(test, "TSMgmtCounterGet", "TestCase1.1", TC_PASS, "ok");
   }
 
-  retVal = TSMgmtFloatGet(CONFIG_PARAM_FLOAT_NAME, &fvalue);
-  if ((retVal == 0) || (fvalue != CONFIG_PARAM_FLOAT_VALUE)) {
+  if ((TS_SUCCESS != TSMgmtFloatGet(CONFIG_PARAM_FLOAT_NAME, &fvalue)) || (fvalue !=
CONFIG_PARAM_FLOAT_VALUE)) {
     SDK_RPRINT(test, "TSMgmtFloatGet", "TestCase2", TC_FAIL, "can not get value of param
%s", CONFIG_PARAM_FLOAT_NAME);
     err = 1;
   } else {
     SDK_RPRINT(test, "TSMgmtFloatGet", "TestCase1.2", TC_PASS, "ok");
   }
 
-  retVal = TSMgmtIntGet(CONFIG_PARAM_INT_NAME, &ivalue);
-  if ((retVal == 0) || (ivalue != CONFIG_PARAM_INT_VALUE)) {
+  if ((TSMgmtIntGet(CONFIG_PARAM_INT_NAME, &ivalue) != TS_SUCCESS) || (ivalue != CONFIG_PARAM_INT_VALUE))
{
     SDK_RPRINT(test, "TSMgmtIntGet", "TestCase1.3", TC_FAIL, "can not get value of param
%s", CONFIG_PARAM_INT_NAME);
     err = 1;
   } else {
     SDK_RPRINT(test, "TSMgmtIntGet", "TestCase1.3", TC_PASS, "ok");
   }
 
-  retVal = TSMgmtStringGet(CONFIG_PARAM_STRING_NAME, &svalue);
-  if (retVal == 0) {
+  if (TS_SUCCESS != TSMgmtStringGet(CONFIG_PARAM_STRING_NAME, &svalue)) {
     SDK_RPRINT(test, "TSMgmtStringGet", "TestCase1.4", TC_FAIL, "can not get value of param
%s", CONFIG_PARAM_STRING_NAME);
     err = 1;
   } else if (strcmp(svalue, CONFIG_PARAM_STRING_VALUE) != 0) {

Modified: trafficserver/traffic/trunk/proxy/InkAPITestTool.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITestTool.cc?rev=1072388&r1=1072387&r2=1072388&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITestTool.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITestTool.cc Sat Feb 19 16:57:20 2011
@@ -431,7 +431,7 @@ synclient_txn_create(void)
   TSMgmtInt proxy_port;
 
   ClientTxn *txn = (ClientTxn *) TSmalloc(sizeof(ClientTxn));
-  if (!TSMgmtIntGet(PROXY_CONFIG_NAME_HTTP_PORT, &proxy_port)) {
+  if (TSMgmtIntGet(PROXY_CONFIG_NAME_HTTP_PORT, &proxy_port) != TS_SUCCESS) {
     proxy_port = PROXY_HTTP_DEFAULT_PORT;
   }
   txn->connect_port = (int) proxy_port;

Modified: trafficserver/traffic/trunk/proxy/api/ts/experimental.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/experimental.h?rev=1072388&r1=1072387&r2=1072388&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/experimental.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/experimental.h Sat Feb 19 16:57:20 2011
@@ -51,7 +51,7 @@ extern "C"
 
   /* Do not edit these apis, used internally */
   tsapi int TSMimeHdrFieldEqual(TSMBuffer bufp, TSMLoc hdr_obj, TSMLoc field1, TSMLoc field2);
-  tsapi int TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc funcp);
+  tsapi TSReturnCode TSHttpTxnHookRegisteredFor(TSHttpTxn txnp, TSHttpHookID id, TSEventFunc
funcp);
 
   /* IP Lookup */
   typedef void *TSIPLookup;
@@ -61,8 +61,8 @@ extern "C"
   tsapi void TSIPLookupPrint(TSIPLookup iplu, TSIPLookupPrintFunc pf);
   tsapi void TSIPLookupNewEntry(TSIPLookup iplu, uint32_t addr1, uint32_t addr2, void *data);
   tsapi int TSIPLookupMatch(TSIPLookup iplu, uint32_t addr, void **data);
-  tsapi int TSIPLookupMatchFirst(TSIPLookup iplu, uint32_t addr, TSIPLookupState iplus, void
**data);
-  tsapi int TSIPLookupMatchNext(TSIPLookup iplu, TSIPLookupState iplus, void **data);
+  tsapi TSReturnCode TSIPLookupMatchFirst(TSIPLookup iplu, uint32_t addr, TSIPLookupState
iplus, void **data);
+  tsapi TSReturnCode TSIPLookupMatchNext(TSIPLookup iplu, TSIPLookupState iplus, void **data);
 
   /* for Media-IXT mms over http */
   typedef enum
@@ -80,7 +80,7 @@ extern "C"
      TSHttpTxnCntl(.., TS_HTTP_CNTL_GET_LOGGING_MODE, &onoff);
      if (onoff == TS_HTTP_CNTL_ON) ....
   */
-  tsapi int TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data);
+  tsapi TSReturnCode TSHttpTxnCntl(TSHttpTxn txnp, TSHttpCntlType cntl, void *data);
 
 
   /* Protocols APIs */

Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h.in?rev=1072388&r1=1072387&r2=1072388&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Sat Feb 19 16:57:20 2011
@@ -2018,10 +2018,10 @@ extern "C"
 
   /* --------------------------------------------------------------------------
      Management */
-  tsapi int TSMgmtIntGet(const char *var_name, TSMgmtInt *result);
-  tsapi int TSMgmtCounterGet(const char *var_name, TSMgmtCounter *result);
-  tsapi int TSMgmtFloatGet(const char *var_name, TSMgmtFloat *result);
-  tsapi int TSMgmtStringGet(const char *var_name, TSMgmtString *result);
+  tsapi TSReturnCode TSMgmtIntGet(const char *var_name, TSMgmtInt *result);
+  tsapi TSReturnCode TSMgmtCounterGet(const char *var_name, TSMgmtCounter *result);
+  tsapi TSReturnCode TSMgmtFloatGet(const char *var_name, TSMgmtFloat *result);
+  tsapi TSReturnCode TSMgmtStringGet(const char *var_name, TSMgmtString *result);
 
   /* --------------------------------------------------------------------------
      Continuations */
@@ -2267,7 +2267,7 @@ extern "C"
   tsapi void TSFetchPages(TSFetchUrlParams_t *params);
 
   /* Check if HTTP State machine is internal or not */
-  tsapi int TSHttpIsInternalRequest(TSHttpTxn txnp);
+  tsapi TSReturnCode TSHttpIsInternalRequest(TSHttpTxn txnp);
 
   /* --------------------------------------------------------------------------
      HTTP alternate selection */



Mime
View raw message