trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1071494 - in /trafficserver/traffic/trunk: ./ example/append-transform/ example/bnull-transform/ example/cache_scan/ example/include_other/ example/null-transform/ example/output-header/ example/server-transform/ example/thread-pool/ iocor...
Date Thu, 17 Feb 2011 03:13:25 GMT
Author: zwoop
Date: Thu Feb 17 03:13:24 2011
New Revision: 1071494

URL: http://svn.apache.org/viewvc?rev=1071494&view=rev
Log:
TS-590 Eliminate TS_ERROR_PTR, and cleanup error checking

Modified:
    trafficserver/traffic/trunk/configure.ac
    trafficserver/traffic/trunk/example/append-transform/append-transform.c
    trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c
    trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc
    trafficserver/traffic/trunk/example/include_other/macro.h
    trafficserver/traffic/trunk/example/null-transform/null-transform.c
    trafficserver/traffic/trunk/example/output-header/output-header.c
    trafficserver/traffic/trunk/example/server-transform/server-transform.c
    trafficserver/traffic/trunk/example/thread-pool/psi.c
    trafficserver/traffic/trunk/iocore/cache/CachePages.cc
    trafficserver/traffic/trunk/lib/ts/ink_assert.cc
    trafficserver/traffic/trunk/lib/ts/ink_config.h.in
    trafficserver/traffic/trunk/proxy/InkAPI.cc
    trafficserver/traffic/trunk/proxy/InkAPITest.cc
    trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc
    trafficserver/traffic/trunk/proxy/api/ts/ts.h.in

Modified: trafficserver/traffic/trunk/configure.ac
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/configure.ac?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/configure.ac (original)
+++ trafficserver/traffic/trunk/configure.ac Thu Feb 17 03:13:24 2011
@@ -151,6 +151,21 @@ AC_ARG_ENABLE([debug],
 AC_MSG_RESULT([$enable_debug])
 
 #
+# Fast SDK APIs, this disables the parameter checks (assert)
+# on all APIs.
+#
+
+AC_MSG_CHECKING([whether to enable fast SDK APIs])
+AC_ARG_ENABLE([fast-sdk],
+  [AS_HELP_STRING([--enable-fast-sdk],[enable fast SDK APIs (no input parameter sanity checks)])],
+  [],
+  [enable_fast_sdk=no]
+)
+AC_MSG_RESULT([$enable_fast_sdk])
+TS_ARG_ENABLE_VAR([use], [fast-sdk])
+AC_SUBST(use_fast_sdk)
+
+#
 # Diags
 #
 

Modified: trafficserver/traffic/trunk/example/append-transform/append-transform.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/append-transform/append-transform.c?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/append-transform/append-transform.c (original)
+++ trafficserver/traffic/trunk/example/append-transform/append-transform.c Thu Feb 17 03:13:24 2011
@@ -62,7 +62,7 @@ my_data_alloc()
   MyData *data;
 
   data = (MyData *) TSmalloc(sizeof(MyData));
-  TSReleaseAssert(data && data != TS_ERROR_PTR);
+  TSReleaseAssert(data);
 
   data->output_vio = NULL;
   data->output_buffer = NULL;
@@ -331,7 +331,6 @@ load(const char *filename)
 
   append_buffer = TSIOBufferCreate();
   append_buffer_reader = TSIOBufferReaderAlloc(append_buffer);
-  TSAssert(append_buffer_reader != TS_ERROR_PTR);
 
   for (;;) {
     blk = TSIOBufferStart(append_buffer);

Modified: trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c (original)
+++ trafficserver/traffic/trunk/example/bnull-transform/bnull-transform.c Thu Feb 17 03:13:24 2011
@@ -123,10 +123,7 @@ handle_buffering(TSCont contp, MyData * 
 
     if (towrite > 0) {
       /* Copy the data from the read buffer to the input buffer. */
-      if (TSIOBufferCopy(data->output_buffer, TSVIOReaderGet(write_vio), towrite, 0) == TS_ERROR) {
-        TSError("[bnull-transform] Unable to copy read buffer\n");
-        goto Lerror;
-      }
+      TSIOBufferCopy(data->output_buffer, TSVIOReaderGet(write_vio), towrite, 0);
 
       /* Tell the read buffer that we have read the data and are no
          longer interested in it. */
@@ -155,8 +152,6 @@ handle_buffering(TSCont contp, MyData * 
 
   return 1;
 
-Lerror:
-
   /* If we are in this code path then something is seriously wrong. */
   TSError("[bnull-transform] Fatal error in plugin");
   TSReleaseAssert(!"[bnull-transform] Fatal error in plugin\n");

Modified: trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc (original)
+++ trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc Thu Feb 17 03:13:24 2011
@@ -269,28 +269,16 @@ handle_io(TSCont contp, TSEvent event, v
 
       if (cstate->key_to_delete) {
         TSAction actionp = TSCacheRemove(contp, cstate->key_to_delete);
-        if (actionp != TS_ERROR_PTR) {
-          if (!TSActionDone(actionp)) {
-            cstate->pending_action = actionp;
-          }
-        } else {
-          TSError("CacheRemove action failed");
-          cleanup(contp);
-          return 0;
+        if (!TSActionDone(actionp)) {
+          cstate->pending_action = actionp;
         }
       } else {
         char head[] = "<h3>Cache Contents:</h3>\n<p><pre>\n";
         cstate->total_bytes += TSIOBufferWrite(cstate->resp_buffer, head, sizeof(head) - 1);
         //start scan
         TSAction actionp = TSCacheScan(contp, 0, 512000);
-        if (actionp != TS_ERROR_PTR) {
-          if (!TSActionDone(actionp)) {
-            cstate->pending_action = actionp;
-          }
-        } else {
-          TSError("CacheScan action failed");
-          cleanup(contp);
-          return 0;
+        if (!TSActionDone(actionp)) {
+          cstate->pending_action = actionp;
         }
       }
 

Modified: trafficserver/traffic/trunk/example/include_other/macro.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/include_other/macro.h?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/include_other/macro.h (original)
+++ trafficserver/traffic/trunk/example/include_other/macro.h Thu Feb 17 03:13:24 2011
@@ -64,7 +64,7 @@
 }
 
 /* Release macros */
-#define VALID_PTR(X) ((X != NULL) && (X != TS_ERROR_PTR))
+#define VALID_PTR(X) (X != NULL))
 
 #define FREE(X) \
 { \

Modified: trafficserver/traffic/trunk/example/null-transform/null-transform.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/null-transform/null-transform.c?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/null-transform/null-transform.c (original)
+++ trafficserver/traffic/trunk/example/null-transform/null-transform.c Thu Feb 17 03:13:24 2011
@@ -121,15 +121,9 @@ handle_transform(TSCont contp)
    */
   buf_test = TSVIOBufferGet(input_vio);
 
-  if (buf_test) {
-    if (buf_test == TS_ERROR_PTR) {
-      TSError("[null-transform] error fetching buffer\n");
-      goto Lerror;
-    }
-  } else {
+  if (!buf_test) {
     TSVIONBytesSet(data->output_vio, TSVIONDoneGet(input_vio));
     TSVIOReenable(data->output_vio);
-
     return;
   }
 
@@ -152,10 +146,7 @@ handle_transform(TSCont contp)
 
     if (towrite > 0) {
       /* Copy the data from the read buffer to the output buffer. */
-      if (TSIOBufferCopy(TSVIOBufferGet(data->output_vio), TSVIOReaderGet(input_vio), towrite, 0) == TS_ERROR) {
-        TSError("[null-plugin] unable to copy IO buffers\n");
-        goto Lerror;
-      }
+      TSIOBufferCopy(TSVIOBufferGet(data->output_vio), TSVIOReaderGet(input_vio), towrite, 0);
 
       /* Tell the read buffer that we have read the data and are no
        * longer interested in it.
@@ -167,9 +158,6 @@ handle_transform(TSCont contp)
        */
       TSVIONDoneSet(input_vio, TSVIONDoneGet(input_vio) + towrite);
     }
-  } else if (towrite == TS_ERROR) {
-    TSError("[null-plugin] error fetching VIO to-do amount\n");
-    goto Lerror;
   }
 
   /* Now we check the input VIO to see if there is data left to
@@ -204,10 +192,6 @@ handle_transform(TSCont contp)
      */
     TSContCall(TSVIOContGet(input_vio), TS_EVENT_VCONN_WRITE_COMPLETE, input_vio);
   }
-
-
-Lerror:
-  return;
 }
 
 static int

Modified: trafficserver/traffic/trunk/example/output-header/output-header.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/output-header/output-header.c?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/output-header/output-header.c (original)
+++ trafficserver/traffic/trunk/example/output-header/output-header.c Thu Feb 17 03:13:24 2011
@@ -71,23 +71,8 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
   }
 
   output_buffer = TSIOBufferCreate();
-
-  /* TSIOBufferCreate may return an error pointer */
-  if ((void *) output_buffer == TS_ERROR_PTR) {
-    TSDebug(DEBUG_TAG, "couldn't allocate IOBuffer");
-    TSError("couldn't allocate IOBuffer\n");
-    goto done;
-  }
-
   reader = TSIOBufferReaderAlloc(output_buffer);
 
-  /* TSIOBufferReaderAlloc may return an error pointer */
-  if ((void *) reader == TS_ERROR_PTR) {
-    TSDebug(DEBUG_TAG, "couldn't allocate IOBufferReader");
-    TSError("couldn't allocate IOBufferReader\n");
-    goto done;
-  }
-
   /* This will print  just MIMEFields and not
      the http request line */
   TSDebug(DEBUG_TAG, "Printing the hdrs ... ");
@@ -104,13 +89,6 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
      see the size of the entire header */
   total_avail = TSIOBufferReaderAvail(reader);
 
-  /* TSIOBufferReaderAvail may send an TS_ERROR */
-  if ((TSReturnCode) total_avail == TS_ERROR) {
-    TSDebug(DEBUG_TAG, "couldn't get available byte-count from IO-read-buffer");
-    TSError("couldn't get available byte-count from IO-read-buffer\n");
-    goto done;
-  }
-
   /* Allocate the string with an extra byte for the string
      terminator */
   output_string = (char *) TSmalloc(total_avail + 1);
@@ -120,25 +98,9 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
      sure we get the complete header since the header can
      be in multiple blocks */
   block = TSIOBufferReaderStart(reader);
-
-  /* TSIOBufferReaderStart may return an error pointer */
-  if (block == TS_ERROR_PTR) {
-    TSDebug(DEBUG_TAG, "couldn't get from IOBufferBlock");
-    TSError("couldn't get from IOBufferBlock\n");
-    goto done;
-  }
-
   while (block) {
-
     block_start = TSIOBufferBlockReadStart(block, reader, &block_avail);
 
-    /* TSIOBufferBlockReadStart may return an error pointer */
-    if (block_start == TS_ERROR_PTR) {
-      TSDebug(DEBUG_TAG, "couldn't read from IOBuffer");
-      TSError("couldn't read from IOBuffer\n");
-      goto done;
-    }
-
     /* We'll get a block pointer back even if there is no data
        left to read so check for this condition and break out of
        the loop. A block with no data to read means we've exhausted
@@ -157,13 +119,6 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
     /* Get the next block now that we've consumed the
        data off the last block */
     block = TSIOBufferReaderStart(reader);
-
-    /* TSIOBufferReaderStart may return an error pointer */
-    if (block == TS_ERROR_PTR) {
-      TSDebug(DEBUG_TAG, "couldn't get from IOBufferBlock");
-      TSError("couldn't get from IOBufferBlock\n");
-      goto done;
-    }
   }
 
   /* Terminate the string */

Modified: trafficserver/traffic/trunk/example/server-transform/server-transform.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/server-transform/server-transform.c?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/server-transform/server-transform.c (original)
+++ trafficserver/traffic/trunk/example/server-transform/server-transform.c Thu Feb 17 03:13:24 2011
@@ -119,10 +119,7 @@ transform_create(TSHttpTxn txnp)
   TSCont contp;
   TransformData *data;
 
-  if ((contp = TSTransformCreate(transform_handler, txnp)) == TS_ERROR_PTR) {
-    TSError("Error in creating Transformation. Retyring...");
-    return NULL;
-  }
+  contp = TSTransformCreate(transform_handler, txnp);
 
   data = (TransformData *) TSmalloc(sizeof(TransformData));
   data->state = STATE_BUFFER;
@@ -148,7 +145,7 @@ transform_destroy(TSCont contp)
   TransformData *data;
 
   data = TSContDataGet(contp);
-  if ((data != TS_ERROR_PTR) || (data != NULL)) {
+  if (data != NULL) {
     if (data->input_buf)
       TSIOBufferDestroy(data->input_buf);
 
@@ -163,7 +160,7 @@ transform_destroy(TSCont contp)
 
     TSfree(data);
   } else {
-    TSError("Unable to get Continuation's Data. TSContDataGet returns TS_ERROR_PTR or NULL");
+    TSError("Unable to get Continuation's Data. TSContDataGet returns NULL");
   }
 
   TSContDestroy(contp);
@@ -178,7 +175,7 @@ transform_connect(TSCont contp, Transfor
   data->state = STATE_CONNECT;
 
   content_length = TSIOBufferReaderAvail(data->input_reader);
-  if (content_length != TS_ERROR) {
+  if (content_length >= 0) {
     data->content_length = content_length;
     data->content_length = htonl(data->content_length);
 
@@ -193,39 +190,15 @@ transform_connect(TSCont contp, Transfor
       TSIOBufferReader tempReader;
 
       temp = TSIOBufferCreate();
-      if (temp != TS_ERROR_PTR) {
-        tempReader = TSIOBufferReaderAlloc(temp);
+      tempReader = TSIOBufferReaderAlloc(temp);
 
-        if (tempReader != TS_ERROR_PTR) {
+      TSIOBufferWrite(temp, (const char *) &data->content_length, sizeof(int));
+      TSIOBufferCopy(temp, data->input_reader, data->content_length, 0);
 
-          if (TSIOBufferWrite(temp, (const char *) &data->content_length, sizeof(int)) == TS_ERROR) {
-            TSError("TSIOBufferWrite returns TS_ERROR");
-            TSIOBufferReaderFree(tempReader);
-            TSIOBufferDestroy(temp);
-            return 0;
-          }
-
-          if (TSIOBufferCopy(temp, data->input_reader, data->content_length, 0) == TS_ERROR) {
-            TSError("TSIOBufferCopy returns TS_ERROR");
-            TSIOBufferReaderFree(tempReader);
-            TSIOBufferDestroy(temp);
-            return 0;
-          }
-
-          TSIOBufferReaderFree(data->input_reader);
-          TSIOBufferDestroy(data->input_buf);
-          data->input_buf = temp;
-          data->input_reader = tempReader;
-
-        } else {
-          TSError("Unable to allocate a reader for buffer");
-          TSIOBufferDestroy(temp);
-          return 0;
-        }
-      } else {
-        TSError("Unable to create IOBuffer.");
-        return 0;
-      }
+      TSIOBufferReaderFree(data->input_reader);
+      TSIOBufferDestroy(data->input_buf);
+      data->input_buf = temp;
+      data->input_reader = tempReader;
     }
   } else {
     TSError("TSIOBufferReaderAvail returns TS_ERROR");
@@ -233,12 +206,8 @@ transform_connect(TSCont contp, Transfor
   }
 
   action = TSNetConnect(contp, server_ip, server_port);
-  if (action != TS_ERROR_PTR) {
-    if (!TSActionDone(action)) {
-      data->pending_action = action;
-    }
-  } else {
-    TSError("Unable to connect to server. TSNetConnect returns TS_ERROR_PTR");
+  if (!TSActionDone(action)) {
+    data->pending_action = action;
   }
 
   return 0;
@@ -252,13 +221,8 @@ transform_write(TSCont contp, TransformD
   data->state = STATE_WRITE;
 
   content_length = TSIOBufferReaderAvail(data->input_reader);
-  if (content_length != TS_ERROR) {
-
-    data->server_vio =
-      TSVConnWrite(data->server_vc, contp, TSIOBufferReaderClone(data->input_reader), content_length);
-    if (data->server_vio == TS_ERROR_PTR) {
-      TSError("TSVConnWrite returns TS_ERROR_PTR");
-    }
+  if (content_length >= 0) {
+    data->server_vio = TSVConnWrite(data->server_vc, contp, TSIOBufferReaderClone(data->input_reader), content_length);
   } else {
     TSError("TSIOBufferReaderAvail returns TS_ERROR");
   }
@@ -271,20 +235,13 @@ transform_read_status(TSCont contp, Tran
   data->state = STATE_READ_STATUS;
 
   data->output_buf = TSIOBufferCreate();
-  if ((data->output_buf != NULL) && (data->output_buf != TS_ERROR_PTR)) {
-    data->output_reader = TSIOBufferReaderAlloc(data->output_buf);
-    if ((data->output_reader != NULL) && (data->output_reader != TS_ERROR_PTR)) {
-      data->server_vio = TSVConnRead(data->server_vc, contp, data->output_buf, sizeof(int));
-      if (data->server_vio == TS_ERROR_PTR) {
-        TSError("TSVConnRead returns TS_ERROR_PTR");
-      }
-
-    } else {
-      TSError("Error in Allocating a Reader to output buffer. TSIOBufferReaderAlloc returns NULL or TS_ERROR_PTR");
-    }
+  data->output_reader = TSIOBufferReaderAlloc(data->output_buf);
+  if (data->output_reader != NULL) {
+    data->server_vio = TSVConnRead(data->server_vc, contp, data->output_buf, sizeof(int));
   } else {
-    TSError("Error in creating output buffer. TSIOBufferCreate returns TS_ERROR_PTR");
+    TSError("Error in Allocating a Reader to output buffer. TSIOBufferReaderAlloc returns NULL");
   }
+
   return 0;
 }
 
@@ -298,19 +255,13 @@ transform_read(TSCont contp, TransformDa
   data->input_reader = NULL;
 
   data->server_vio = TSVConnRead(data->server_vc, contp, data->output_buf, data->content_length);
-
-  if (data->server_vio == TS_ERROR_PTR) {
-    TSError("TSVConnRead returns TS_ERROR_PTR");
-    return -1;
-  }
-
   data->output_vc = TSTransformOutputVConnGet((TSVConn) contp);
-  if ((data->output_vc == TS_ERROR_PTR) || (data->output_vc == NULL)) {
-    TSError("TSTransformOutputVConnGet returns NULL or TS_ERROR_PTR");
+  if (data->output_vc == NULL) {
+    TSError("TSTransformOutputVConnGet returns NULL");
   } else {
     data->output_vio = TSVConnWrite(data->output_vc, contp, data->output_reader, data->content_length);
-    if ((data->output_vio == TS_ERROR_PTR) || (data->output_vio == NULL)) {
-      TSError("TSVConnWrite returns NULL or TS_ERROR_PTR");
+    if (data->output_vio == NULL) {
+      TSError("TSVConnWrite returns NULL");
     }
   }
 
@@ -336,13 +287,13 @@ transform_bypass(TSCont contp, Transform
 
   TSIOBufferReaderConsume(data->input_reader, sizeof(int));
   data->output_vc = TSTransformOutputVConnGet((TSVConn) contp);
-  if ((data->output_vc == TS_ERROR_PTR) || (data->output_vc == NULL)) {
-    TSError("TSTransformOutputVConnGet returns NULL or TS_ERROR_PTR");
+  if (data->output_vc == NULL) {
+    TSError("TSTransformOutputVConnGet returns NULL");
   } else {
     data->output_vio =
       TSVConnWrite(data->output_vc, contp, data->input_reader, TSIOBufferReaderAvail(data->input_reader));
-    if ((data->output_vio == TS_ERROR_PTR) || (data->output_vio == NULL)) {
-      TSError("TSVConnWrite returns NULL or TS_ERROR_PTR");
+    if (data->output_vio == NULL) {
+      TSError("TSVConnWrite returns NULL");
     }
   }
   return 1;
@@ -357,15 +308,7 @@ transform_buffer_event(TSCont contp, Tra
 
   if (!data->input_buf) {
     data->input_buf = TSIOBufferCreate();
-    if ((data->input_buf == NULL) || (data->input_buf == TS_ERROR_PTR)) {
-      TSError("Error in Creating buffer");
-      return -1;
-    }
     data->input_reader = TSIOBufferReaderAlloc(data->input_buf);
-    if ((data->input_reader == NULL) || (data->input_reader == TS_ERROR_PTR)) {
-      TSError("Unable to allocate a reader to input buffer.");
-      return -1;
-    }
   }
 
   /* Get the write VIO for the write operation that was performed on
@@ -391,33 +334,21 @@ transform_buffer_event(TSCont contp, Tra
     /* The amount of data left to read needs to be truncated by
        the amount of data actually in the read buffer. */
     avail = TSIOBufferReaderAvail(TSVIOReaderGet(write_vio));
-    if (avail == TS_ERROR) {
-      TSError("Unable to get the number of bytes availabe for reading");
-    } else {
-      if (towrite > avail) {
-        towrite = avail;
-      }
-
-      if (towrite > 0) {
-        /* Copy the data from the read buffer to the input buffer. */
-        if (TSIOBufferCopy(data->input_buf, TSVIOReaderGet(write_vio), towrite, 0) == TS_ERROR) {
-          TSError("Error in Copying the buffer");
-        } else {
-
-          /* Tell the read buffer that we have read the data and are no
-             longer interested in it. */
-          TSIOBufferReaderConsume(TSVIOReaderGet(write_vio), towrite);
-
-          /* Modify the write VIO to reflect how much data we've
-             completed. */
-          TSVIONDoneSet(write_vio, TSVIONDoneGet(write_vio) + towrite);
-        }
-      }
+    if (towrite > avail) {
+      towrite = avail;
     }
-  } else {
-    if (towrite == TS_ERROR) {
-      TSError("TSVIONTodoGet returns TS_ERROR");
-      return 0;
+
+    if (towrite > 0) {
+      /* Copy the data from the read buffer to the input buffer. */
+      TSIOBufferCopy(data->input_buf, TSVIOReaderGet(write_vio), towrite, 0);
+
+      /* Tell the read buffer that we have read the data and are no
+         longer interested in it. */
+      TSIOBufferReaderConsume(TSVIOReaderGet(write_vio), towrite);
+
+      /* Modify the write VIO to reflect how much data we've
+         completed. */
+      TSVIONDoneSet(write_vio, TSVIONDoneGet(write_vio) + towrite);
     }
   }
 
@@ -494,22 +425,14 @@ transform_read_status_event(TSCont contp
       buf_ptr = &data->content_length;
       while (read_nbytes > 0) {
         blk = TSIOBufferReaderStart(data->output_reader);
-        if (blk == TS_ERROR_PTR) {
-          TSError("Error in Getting the pointer to starting of reader block");
-        } else {
-          buf = (char *) TSIOBufferBlockReadStart(blk, data->output_reader, &avail);
-          if (buf != TS_ERROR_PTR) {
-            read_ndone = (avail >= read_nbytes) ? read_nbytes : avail;
-            memcpy(buf_ptr, buf, read_ndone);
-            if (read_ndone > 0) {
-              TSIOBufferReaderConsume(data->output_reader, read_ndone);
-              read_nbytes -= read_ndone;
-              /* move ptr frwd by read_ndone bytes */
-              buf_ptr = (char *) buf_ptr + read_ndone;
-            }
-          } else {
-            TSError("TSIOBufferBlockReadStart returns TS_ERROR_PTR");
-          }
+        buf = (char *) TSIOBufferBlockReadStart(blk, data->output_reader, &avail);
+        read_ndone = (avail >= read_nbytes) ? read_nbytes : avail;
+        memcpy(buf_ptr, buf, read_ndone);
+        if (read_ndone > 0) {
+          TSIOBufferReaderConsume(data->output_reader, read_ndone);
+          read_nbytes -= read_ndone;
+          /* move ptr frwd by read_ndone bytes */
+          buf_ptr = (char *) buf_ptr + read_ndone;
         }
       }
       data->content_length = ntohl(data->content_length);
@@ -596,8 +519,8 @@ transform_handler(TSCont contp, TSEvent 
     TransformData *data;
     int val = 0;
 
-    data = (TransformData *) TSContDataGet(contp);
-    if ((data == NULL) && (data == TS_ERROR_PTR)) {
+    data = (TransformData *)TSContDataGet(contp);
+    if (data == NULL) {
       TSError("Didn't get Continuation's Data. Ignoring Event..");
       return 0;
     }
@@ -668,14 +591,7 @@ server_response_ok(TSHttpTxn txnp)
     return 0;
   }
 
-  if ((resp_status = TSHttpHdrStatusGet(bufp, hdr_loc)) == (TSHttpStatus)TS_ERROR) {
-    TSError("Error in Getting Status from Server response");
-    if (TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc) != TS_SUCCESS) {
-      TSError("Unable to release handle to server request");
-    }
-    return 0;
-  }
-
+  resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
   if (TS_HTTP_STATUS_OK == resp_status) {
     if (TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc) != TS_SUCCESS) {
       TSError("Unable to release handle to server request");
@@ -770,10 +686,6 @@ TSPluginInit(int argc, const char *argv[
   server_ip = htonl(server_ip);
   server_port = 7;
 
-  if ((cont = TSContCreate(transform_plugin, NULL)) == TS_ERROR_PTR) {
-    TSError("Unable to create continuation. Aborting...");
-    return;
-  }
-
+  cont = TSContCreate(transform_plugin, NULL);
   TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, cont);
 }

Modified: trafficserver/traffic/trunk/example/thread-pool/psi.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/thread-pool/psi.c?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/thread-pool/psi.c (original)
+++ trafficserver/traffic/trunk/example/thread-pool/psi.c Thu Feb 17 03:13:24 2011
@@ -230,10 +230,6 @@ strsearch_ioreader(TSIOBufferReader read
   if (slen <= 0) {
     return STR_FAIL;
   }
-  if (block == TS_ERROR_PTR) {
-    TSError("[strsearch_ioreader] Error while getting block from ioreader");
-    return STR_FAIL;
-  }
 
   *nparse = 0;
 
@@ -243,11 +239,6 @@ strsearch_ioreader(TSIOBufferReader read
     const char *blockptr = TSIOBufferBlockReadStart(block, reader, &blocklen);
     const char *ptr;
 
-    if (blockptr == TS_ERROR_PTR) {
-      TSError("[strsearch_ioreader] Error while getting block pointer");
-      break;
-    }
-
     for (ptr = blockptr; ptr < blockptr + blocklen; ptr++) {
       (*nparse)++;
       if (*ptr == pattern[index]) {
@@ -262,10 +253,6 @@ strsearch_ioreader(TSIOBufferReader read
 
     /* Parse next block */
     block = TSIOBufferBlockNext(block);
-    if (block == TS_ERROR_PTR) {
-      TSError("[strsearch_ioreader] Error while getting block from ioreader");
-      return STR_FAIL;
-    }
   }
 
   *nparse -= index;             /* Adjust nparse so it doesn't include matching chars */
@@ -313,21 +300,12 @@ strextract_ioreader(TSIOBufferReader rea
   if (plen <= 0) {
     return STR_FAIL;
   }
-  if (block == TS_ERROR_PTR) {
-    TSError("[strextract_ioreader] Error while getting block from ioreader");
-    return STR_FAIL;
-  }
 
   /* Now start extraction */
   while ((block != NULL) && (p_idx < plen) && (buf_idx < PSI_FILENAME_MAX_SIZE)) {
     int64_t blocklen;
     const char *blockptr = TSIOBufferBlockReadStart(block, reader, &blocklen);
 
-    if (blockptr == TS_ERROR_PTR) {
-      TSError("[strsearch_ioreader] Error while getting block pointer");
-      break;
-    }
-
     for (ptr = blockptr; ptr < blockptr + blocklen; ptr++, nbytes_so_far++) {
       if (nbytes_so_far >= offset) {
 
@@ -352,10 +330,6 @@ strextract_ioreader(TSIOBufferReader rea
     }
 
     block = TSIOBufferBlockNext(block);
-    if (block == TS_ERROR_PTR) {
-      TSError("[strextract_ioreader] Error while getting block from ioreader");
-      return STR_FAIL;
-    }
   }
 
   /* Error, could not read end of filename */
@@ -523,11 +497,6 @@ psi_include(TSCont contp, void *edata)
   if (!data->psi_buffer) {
     data->psi_buffer = TSIOBufferCreate();
     data->psi_reader = TSIOBufferReaderAlloc(data->psi_buffer);
-
-    if ((data->psi_buffer == TS_ERROR_PTR) || (data->psi_reader == TS_ERROR_PTR)) {
-      TSError("[psi_include] Could not create iobuffer to store include content");
-      goto error;
-    }
   }
 
   /* For security reason, we do not allow to include files that are
@@ -550,15 +519,7 @@ psi_include(TSCont contp, void *edata)
       while (ntodo > 0) {
         /* TSIOBufferStart allocates more blocks if required */
         block = TSIOBufferStart(data->psi_buffer);
-        if (block == TS_ERROR_PTR) {
-          TSError("[psi_include] Could not get buffer block");
-          goto error;
-        }
         ptr_block = TSIOBufferBlockWriteStart(block, &avail);
-        if (ptr_block == TS_ERROR_PTR) {
-          TSError("[psi_include] Could not get buffer block");
-          goto error;
-        }
         towrite = MIN(ntodo, avail);
 
         memcpy(ptr_block, buf + ndone, towrite);
@@ -586,11 +547,11 @@ psi_include(TSCont contp, void *edata)
      TS_HTTP_READ_REQUEST_HDR, TS_HTTP_OS_DNS and so on...) we could
      use TSHttpTxnReenable to wake up the transaction instead of sending an event. */
 
-error:
   TSContSchedule(contp, 0, TS_THREAD_POOL_DEFAULT);
   data->psi_success = 0;
   data->state = STATE_READ_DATA;
   TSMutexUnlock(TSContMutexGet(contp));
+
   return 0;
 }
 
@@ -619,10 +580,6 @@ wake_up_streams(TSCont contp)
 
   input_vio = TSVConnWriteVIOGet(contp);
   ntodo = TSVIONTodoGet(input_vio);
-  if (ntodo == TS_ERROR) {
-    TSError("[wake_up_streams] Error while getting bytes left to read");
-    return 0;
-  }
 
   if (ntodo > 0) {
     TSVIOReenable(data->output_vio);
@@ -665,10 +622,6 @@ handle_transform(TSCont contp)
 
   /* Get the output (downstream) vconnection where we'll write data to. */
   output_conn = TSTransformOutputVConnGet(contp);
-  if (output_conn == TS_ERROR_PTR) {
-    TSError("[handle_transform] Error while getting transform VC");
-    return 1;
-  }
 
   /* Get upstream vio */
   input_vio = TSVConnWriteVIOGet(contp);
@@ -681,11 +634,6 @@ handle_transform(TSCont contp)
 
     /* INT64_MAX because we don't know yet how much bytes we'll produce */
     data->output_vio = TSVConnWrite(output_conn, contp, data->output_reader, INT64_MAX);
-
-    if (data->output_vio == TS_ERROR_PTR) {
-      TSError("[handle_transform] Error while writing to downstream VC");
-      return 0;
-    }
   }
 
   /* If the input VIO's buffer is NULL, the transformation is over */
@@ -702,10 +650,6 @@ handle_transform(TSCont contp)
   if (toread > 0) {
     input_reader = TSVIOReaderGet(input_vio);
     avail = TSIOBufferReaderAvail(input_reader);
-    if (avail == TS_ERROR) {
-      TSError("[handle_transform] Error while getting number of bytes available");
-      return 0;
-    }
 
     /* There are some data available for reading. Let's parse it */
     if (avail > 0) {
@@ -726,11 +670,6 @@ handle_transform(TSCont contp)
 
         /* Copy the data from the read buffer to the output buffer. */
         retval = TSIOBufferCopy(TSVIOBufferGet(data->output_vio), TSVIOReaderGet(input_vio), towrite, 0);
-        if (retval == TS_ERROR) {
-          TSError("[handle_transform] Error while copying bytes to output VC");
-          return 0;
-        }
-
         /* Reenable the output connection so it can read the data we've produced. */
         TSVIOReenable(data->output_vio);
       }
@@ -796,21 +735,12 @@ dump_psi(TSCont contp)
   /* If script exec succeded, copy its output to the downstream vconn */
   if (data->psi_success == 1) {
     psi_output_len = TSIOBufferReaderAvail(data->psi_reader);
-    if (psi_output_len == TS_ERROR) {
-      TSError("[dump_psi] Error while getting available bytes from reader");
-      return 1;
-    }
 
     if (psi_output_len > 0) {
       data->transform_bytes += psi_output_len;
 
       TSDebug(DBG_TAG, "Inserting %d bytes from include file", psi_output_len);
       retval = TSIOBufferCopy(TSVIOBufferGet(data->output_vio), data->psi_reader, psi_output_len, 0);
-      if (retval == TS_ERROR) {
-        TSError("[dump_psi] Error while copying include bytes to downstream VC");
-        return 1;
-      }
-
       /* Consume all the output data */
       TSIOBufferReaderConsume(data->psi_reader, psi_output_len);
 
@@ -866,9 +796,6 @@ transform_handler(TSCont contp, TSEvent 
 
   /* Check to see if the transformation has been closed */
   retval = TSVConnClosedGet(contp);
-  if (retval == TS_ERROR) {
-    TSError("[transform_handler] Error while getting close status of transformation");
-  }
   if (retval) {
     /* If the thread is still executing its job, we don't want to destroy
        the continuation right away as the thread will call us back
@@ -970,10 +897,7 @@ transformable(TSHttpTxn txnp)
   TSHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
 
   resp_status = TSHttpHdrStatusGet(bufp, hdr_loc);
-  if (resp_status == (TSHttpStatus)TS_ERROR) {
-    TSError("[transformable] Error while getting http status");
-  }
-  if ((resp_status == (TSHttpStatus)TS_ERROR) || (resp_status != TS_HTTP_STATUS_OK)) {
+  if (resp_status != TS_HTTP_STATUS_OK) {
     TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
     return 0;
   }
@@ -1025,11 +949,6 @@ transform_add(TSHttpTxn txnp)
   ContData *data;
 
   contp = TSTransformCreate(transform_handler, txnp);
-  if (contp == TS_ERROR_PTR) {
-    TSError("[transform_add] Error while creating a new transformation");
-    return 0;
-  }
-
   data = cont_data_alloc();
   TSContDataSet(contp, data);
 

Modified: trafficserver/traffic/trunk/iocore/cache/CachePages.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CachePages.cc?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CachePages.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CachePages.cc Thu Feb 17 03:13:24 2011
@@ -387,7 +387,7 @@ ShowCache::handleCacheEvent(int event, E
       if (!cvio) {
         buffer = new_empty_MIOBuffer();
         buffer_reader = buffer->alloc_reader();
-        TSVConnCacheObjectSizeGet(cache_vc, &content_length);
+        content_length = TSVConnCacheObjectSizeGet(cache_vc);
         cvio = cache_vc->do_io_read(this, content_length, buffer);
       } else
         buffer_reader->consume(buffer_reader->read_avail());

Modified: trafficserver/traffic/trunk/lib/ts/ink_assert.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_assert.cc?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_assert.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_assert.cc Thu Feb 17 03:13:24 2011
@@ -35,8 +35,6 @@ Assertions
 int
 _ink_assert(const char *a, const char *f, int l)
 {
-
-#ifndef NO_ASSERTS
   char buf1[256];
   char buf2[512];
   ink_strlcpy(buf1, f, sizeof(buf1));
@@ -44,7 +42,6 @@ _ink_assert(const char *a, const char *f
   ink_strlcat(buf2, a, sizeof(buf2));
   ink_strlcat(buf2, "`", sizeof(buf2));
   ink_fatal(1, buf2);
-#endif /* NO_ASSERTS */
 
   return (0);
 }

Modified: trafficserver/traffic/trunk/lib/ts/ink_config.h.in
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_config.h.in?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_config.h.in (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_config.h.in Thu Feb 17 03:13:24 2011
@@ -98,6 +98,7 @@
 
 #define TS_HAS_BACKTRACE               @has_backtrace@
 #define TS_HAS_PROFILER                @has_profiler@
+#define TS_USE_FAST_SDK                @use_fast_sdk@
 #define TS_USE_DIAGS                   @use_diags@
 #define TS_USE_LIBEV                   @use_libev@
 #define TS_USE_EPOLL                   @use_epoll@

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Thu Feb 17 03:13:24 2011
@@ -357,8 +357,6 @@ static ClassAllocator<INKContInternal> I
 static ClassAllocator<INKVConnInternal> INKVConnAllocator("INKVConnAllocator");
 static ClassAllocator<MIMEFieldSDKHandle> mHandleAllocator("MIMEFieldSDKHandle");
 
-// Error Ptr.
-tsapi const void *TS_ERROR_PTR = (const void*) 0x00000bad;
 
 ////////////////////////////////////////////////////////////////////
 //
@@ -404,8 +402,12 @@ _TSAssert(const char *text, const char *
 }
 
 // This assert is for internal API use only.
+#if TS_USE_FAST_SDK
+#define sdk_assert(EX) (void)(EX)
+#else
 #define sdk_assert(EX)                                          \
   (void)((EX) || (_TSReleaseAssert(#EX, __FILE__, __LINE__)))
+#endif
 
 ////////////////////////////////////////////////////////////////////
 //
@@ -2276,6 +2278,7 @@ TSMimeParserCreate(void)
   TSMimeParser parser;
 
   parser = xmalloc(sizeof(MIMEParser));
+  // TODO: Should remove this when memory allocation can't fail.
   sdk_assert(sdk_sanity_check_mime_parser(parser) == TS_SUCCESS);
 
   mime_parser_init((MIMEParser *) parser);
@@ -2312,7 +2315,6 @@ TSMimeHdrCreate(TSMBuffer bufp, TSMLoc *
   // Allow to modify the buffer only
   // if bufp is modifiable. If bufp is not modifiable return
   // TS_ERROR. If not allowed, return NULL.
-  // Changed the return value for SDK3.0 from NULL to TS_ERROR_PTR.
   sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS);
   sdk_assert(sdk_sanity_check_null_ptr((void*)locp) == TS_SUCCESS);
 
@@ -2718,7 +2720,6 @@ TSMimeHdrFieldCreate(TSMBuffer bufp, TSM
   // Allow to modify the buffer only
   // if bufp is modifiable. If bufp is not modifiable return
   // TS_ERROR. If not allowed, return NULL.
-  // Changed the return value to TS_ERROR_PTR from NULL in case of errors.
   sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS);
   sdk_assert((sdk_sanity_check_mime_hdr_handle(mh_mloc) == TS_SUCCESS) ||
              (sdk_sanity_check_http_hdr_handle(mh_mloc) == TS_SUCCESS));
@@ -3540,17 +3541,13 @@ TSHttpHdrTypeGet(TSMBuffer bufp, TSMLoc 
 TSReturnCode
 TSHttpHdrTypeSet(TSMBuffer bufp, TSMLoc obj, TSHttpType type)
 {
-#ifdef DEBUG
-  if ((type<TS_HTTP_TYPE_UNKNOWN) || (type> TS_HTTP_TYPE_RESPONSE)) {
-    return TS_ERROR;
-  }
-#endif
   // Allow to modify the buffer only
   // if bufp is modifiable. If bufp is not modifiable return
   // TS_ERROR. If allowed, return TS_SUCCESS. Changed the
   // return value of function from void to TSReturnCode.
   sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS);
   sdk_assert(sdk_sanity_check_http_hdr_handle(obj) == TS_SUCCESS);
+  sdk_assert((type >= TS_HTTP_TYPE_UNKNOWN) && (type <= TS_HTTP_TYPE_RESPONSE));
 
   if (!isWriteable(bufp))
     return TS_ERROR;

Modified: trafficserver/traffic/trunk/proxy/InkAPITest.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPITest.cc?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPITest.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPITest.cc Thu Feb 17 03:13:24 2011
@@ -2895,16 +2895,12 @@ REGRESSION_TEST(SDK_API_TSUrl) (Regressi
   if (TSUrlPortSet(bufp1, url_loc1, port) != TS_SUCCESS) {
     SDK_RPRINT(test, "TSUrlPortSet", "TestCase1", TC_FAIL, "Returned TS_ERROR");
   } else {
-    port_get = 80;
-    if ((port_get = TSUrlPortGet(bufp1, url_loc1)) == TS_ERROR) {
-      SDK_RPRINT(test, "TSUrlPortSet|Get", "TestCase1", TC_FAIL, "TSUrlPortGet Returned TS_ERROR");
-    } else {
-      if (port_get == port) {
-        SDK_RPRINT(test, "TSUrlPortSet&Get", "TestCase1", TC_PASS, "ok");
-        test_passed_port = true;
-      } else {
-        SDK_RPRINT(test, "TSUrlPortSet&Get", "TestCase1", TC_FAIL, "Values don't match");
-      }
+    port_get = TSUrlPortGet(bufp1, url_loc1);
+    if (port_get == port) {
+      SDK_RPRINT(test, "TSUrlPortSet&Get", "TestCase1", TC_PASS, "ok");
+      test_passed_port = true;
+    } else {
+      SDK_RPRINT(test, "TSUrlPortSet&Get", "TestCase1", TC_FAIL, "Values don't match");
     }
   }
 
@@ -2961,15 +2957,12 @@ REGRESSION_TEST(SDK_API_TSUrl) (Regressi
   }
 
   //Length
-  if ((url_length_from_1 = TSUrlLengthGet(bufp1, url_loc1)) == TS_ERROR) {
-    SDK_RPRINT(test, "TSUrlLengthGet", "TestCase1", TC_FAIL, "Returns TS_ERROR");
+  url_length_from_1 = TSUrlLengthGet(bufp1, url_loc1);
+  if (url_length_from_1 == url_expected_length) {
+    SDK_RPRINT(test, "TSUrlLengthGet", "TestCase1", TC_PASS, "ok");
+    test_passed_length1 = true;
   } else {
-    if (url_length_from_1 == url_expected_length) {
-      SDK_RPRINT(test, "TSUrlLengthGet", "TestCase1", TC_PASS, "ok");
-      test_passed_length1 = true;
-    } else {
-      SDK_RPRINT(test, "TSUrlLengthGet", "TestCase1", TC_FAIL, "Values don't match");
-    }
+    SDK_RPRINT(test, "TSUrlLengthGet", "TestCase1", TC_FAIL, "Values don't match");
   }
 
   //String
@@ -2992,15 +2985,12 @@ REGRESSION_TEST(SDK_API_TSUrl) (Regressi
     SDK_RPRINT(test, "TSUrlCopy", "TestCase1", TC_FAIL, "Returned TS_ERROR");
   } else {
     //Length Test Case 2
-    if ((url_length_from_2 = TSUrlLengthGet(bufp2, url_loc2)) == TS_ERROR) {
-      SDK_RPRINT(test, "TSUrlLengthGet", "TestCase2", TC_FAIL, "Returns TS_ERROR");
+    url_length_from_2 = TSUrlLengthGet(bufp2, url_loc2);
+    if (url_length_from_2 == url_expected_length) {
+      SDK_RPRINT(test, "TSUrlLengthGet", "TestCase2", TC_PASS, "ok");
+      test_passed_length2 = true;
     } else {
-      if (url_length_from_2 == url_expected_length) {
-        SDK_RPRINT(test, "TSUrlLengthGet", "TestCase2", TC_PASS, "ok");
-        test_passed_length2 = true;
-      } else {
-        SDK_RPRINT(test, "TSUrlCopy", "TestCase1", TC_FAIL, "Values don't match");
-      }
+      SDK_RPRINT(test, "TSUrlCopy", "TestCase1", TC_FAIL, "Values don't match");
     }
 
 
@@ -3055,21 +3045,19 @@ REGRESSION_TEST(SDK_API_TSUrl) (Regressi
   if (TSUrlFtpTypeSet(bufp1, url_loc1, type) != TS_SUCCESS) {
     SDK_RPRINT(test, "TSUrlFtpTypeSet", "TestCase1", TC_FAIL, "TSUrlFtpTypeSet Returned TS_ERROR");
   } else {
-    if ((type_get = TSUrlFtpTypeGet(bufp1, url_loc1)) == TS_ERROR) {
-      SDK_RPRINT(test, "TSUrlFtpTypeSet|Get", "TestCase1", TC_FAIL, "TSUrlFtpTypeGet Returned TS_ERROR");
+    type_get = TSUrlFtpTypeGet(bufp1, url_loc1);
+    if (type_get == type) {
+      SDK_RPRINT(test, "TSUrlFtpTypeSet&Get", "TestCase1", TC_PASS, "ok");
+      test_passed_type = true;
     } else {
-      if (type_get == type) {
-        SDK_RPRINT(test, "TSUrlFtpTypeSet&Get", "TestCase1", TC_PASS, "ok");
-        test_passed_type = true;
-      } else {
-        SDK_RPRINT(test, "TSUrlFtpTypeSet&Get", "TestCase1", TC_FAIL, "Values don't match");
-      }
+      SDK_RPRINT(test, "TSUrlFtpTypeSet&Get", "TestCase1", TC_FAIL, "Values don't match");
     }
   }
 
 
   if ((TSUrlDestroy(bufp1, url_loc1) == TS_ERROR) &&
-      (TSUrlDestroy(bufp2, url_loc2) == TS_ERROR) && (TSUrlDestroy(bufp3, url_loc3) == TS_ERROR)) {
+      (TSUrlDestroy(bufp2, url_loc2) == TS_ERROR) &&
+      (TSUrlDestroy(bufp3, url_loc3) == TS_ERROR)) {
     SDK_RPRINT(test, "TSUrlCreate", "TestCase1&2", TC_PASS, "ok");
     SDK_RPRINT(test, "TSUrlDestroy", "TestCase1|2|3", TC_FAIL, "Returns TS_ERROR");
   } else {
@@ -3258,16 +3246,13 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
         (TSHttpHdrTypeSet(bufp2, hdr_loc2, TS_HTTP_TYPE_RESPONSE) == TS_ERROR)) {
       SDK_RPRINT(test, "TSHttpHdrTypeSet", "TestCase1|2", TC_FAIL, "TSHttpHdrTypeSet returns TS_ERROR");
     } else {
-      if (((hdr1type = TSHttpHdrTypeGet(bufp1, hdr_loc1)) == (TSHttpType) TS_ERROR) ||
-          ((hdr2type = TSHttpHdrTypeGet(bufp2, hdr_loc2)) == (TSHttpType) TS_ERROR)) {
-        SDK_RPRINT(test, "TSHttpHdrTypeSet&Get", "TestCase1|2", TC_FAIL, "TSHttpHdrTypeGet returns TS_ERROR");
-      } else {
-        if ((hdr1type == TS_HTTP_TYPE_REQUEST) && (hdr2type == TS_HTTP_TYPE_RESPONSE)) {
-          SDK_RPRINT(test, "TSHttpHdrTypeSet&Get", "TestCase1&2", TC_PASS, "ok");
-          test_passed_Http_Hdr_Type = true;
-        } else {
-          SDK_RPRINT(test, "TSHttpHdrTypeSet&Get", "TestCase1&2", TC_FAIL, "Values mismatch");
-        }
+      hdr1type = TSHttpHdrTypeGet(bufp1, hdr_loc1);
+      hdr2type = TSHttpHdrTypeGet(bufp2, hdr_loc2);
+      if ((hdr1type == TS_HTTP_TYPE_REQUEST) && (hdr2type == TS_HTTP_TYPE_RESPONSE)) {
+        SDK_RPRINT(test, "TSHttpHdrTypeSet&Get", "TestCase1&2", TC_PASS, "ok");
+        test_passed_Http_Hdr_Type = true;
+      } else {
+        SDK_RPRINT(test, "TSHttpHdrTypeSet&Get", "TestCase1&2", TC_FAIL, "Values mismatch");
       }
     }
   } else {
@@ -3361,15 +3346,12 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
     if (TSHttpHdrStatusSet(bufp2, hdr_loc2, TS_HTTP_STATUS_OK) == TS_ERROR) {
       SDK_RPRINT(test, "TSHttpHdrStatusSet&Get", "TestCase1", TC_FAIL, "TSHttpHdrStatusSet returns TS_ERROR");
     } else {
-      if ((status_get = TSHttpHdrStatusGet(bufp2, hdr_loc2)) == (TSHttpStatus) TS_ERROR) {
-        SDK_RPRINT(test, "TSHttpHdrStatusSet&Get", "TestCase1", TC_FAIL, "TSHttpHdrStatusGet returns TS_ERROR");
+      status_get = TSHttpHdrStatusGet(bufp2, hdr_loc2);
+      if (status_get == TS_HTTP_STATUS_OK) {
+        SDK_RPRINT(test, "TSHttpHdrStatusSet&Get", "TestCase1", TC_PASS, "ok");
+        test_passed_Http_Hdr_Status = true;
       } else {
-        if (status_get == TS_HTTP_STATUS_OK) {
-          SDK_RPRINT(test, "TSHttpHdrStatusSet&Get", "TestCase1", TC_PASS, "ok");
-          test_passed_Http_Hdr_Status = true;
-        } else {
-          SDK_RPRINT(test, "TSHttpHdrStatusSet&Get", "TestCase1", TC_FAIL, "Value's mismatch");
-        }
+        SDK_RPRINT(test, "TSHttpHdrStatusSet&Get", "TestCase1", TC_FAIL, "Value's mismatch");
       }
     }
   } else {
@@ -3381,15 +3363,12 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
     if (TSHttpHdrVersionSet(bufp1, hdr_loc1, TS_HTTP_VERSION(version_major, version_minor)) == TS_ERROR) {
       SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase1", TC_FAIL, "TSHttpHdrVersionSet returns TS_ERROR");
     } else {
-      if ((version_get = TSHttpHdrVersionGet(bufp1, hdr_loc1)) == TS_ERROR) {
-        SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase1", TC_FAIL, "TSHttpHdrVersionGet returns TS_ERROR");
+      version_get = TSHttpHdrVersionGet(bufp1, hdr_loc1);
+      if ((version_major == TS_HTTP_MAJOR(version_get)) && (version_minor == TS_HTTP_MINOR(version_get))) {
+        SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase1", TC_PASS, "ok");
+        test_passed_Http_Hdr_Version = true;
       } else {
-        if ((version_major == TS_HTTP_MAJOR(version_get)) && (version_minor == TS_HTTP_MINOR(version_get))) {
-          SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase1", TC_PASS, "ok");
-          test_passed_Http_Hdr_Version = true;
-        } else {
-          SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase1", TC_FAIL, "Value's mismatch");
-        }
+        SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase1", TC_FAIL, "Value's mismatch");
       }
     }
   } else {
@@ -3401,23 +3380,19 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
       SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase2", TC_FAIL, "TSHttpHdrVersionSet returns TS_ERROR");
       test_passed_Http_Hdr_Version = false;
     } else {
-      if ((version_get = TSHttpHdrVersionGet(bufp2, hdr_loc2)) == TS_ERROR) {
-        SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase2", TC_FAIL, "TSHttpHdrVersionGet returns TS_ERROR");
-        test_passed_Http_Hdr_Version = false;
+      version_get = TSHttpHdrVersionGet(bufp2, hdr_loc2);
+      if ((version_major == TS_HTTP_MAJOR(version_get)) && (version_minor == TS_HTTP_MINOR(version_get))) {
+        SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase2", TC_PASS, "ok");
       } else {
-        if ((version_major == TS_HTTP_MAJOR(version_get)) && (version_minor == TS_HTTP_MINOR(version_get))) {
-          SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase2", TC_PASS, "ok");
-        } else {
-          SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase2", TC_FAIL, "Value's mismatch");
-          test_passed_Http_Hdr_Version = false;
-        }
+        SDK_RPRINT(test, "TSHttpHdrVersionSet&Get", "TestCase2", TC_FAIL, "Value's mismatch");
+        test_passed_Http_Hdr_Version = false;
       }
     }
   }
   //Reason Lookup
   if (strcmp("None", TSHttpHdrReasonLookup(TS_HTTP_STATUS_NONE)) != 0) {
     SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase1", TC_FAIL,
-               "TSHttpHdrReasonLookup returns TS_ERROR or Value's mismatch");
+               "TSHttpHdrReasonLookup returns Value's mismatch");
   } else {
     SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase1", TC_PASS, "ok");
     test_passed_Http_Hdr_Reason_Lookup = true;
@@ -3425,7 +3400,7 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
 
   if (strcmp("Ok", TSHttpHdrReasonLookup(TS_HTTP_STATUS_OK)) != 0) {
     SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase2", TC_FAIL,
-               "TSHttpHdrReasonLookup returns TS_ERROR or Value's mismatch");
+               "TSHttpHdrReasonLookup returns Value's mismatch");
     if (test_passed_Http_Hdr_Reason_Lookup == true) {
       test_passed_Http_Hdr_Reason_Lookup = false;
     }
@@ -3435,7 +3410,7 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
 
   if (strcmp("Continue", TSHttpHdrReasonLookup(TS_HTTP_STATUS_CONTINUE)) != 0) {
     SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase3", TC_FAIL,
-               "TSHttpHdrReasonLookup returns TS_ERROR or Value's mismatch");
+               "TSHttpHdrReasonLookup returns Value's mismatch");
     if (test_passed_Http_Hdr_Reason_Lookup == true) {
       test_passed_Http_Hdr_Reason_Lookup = false;
     }
@@ -3445,7 +3420,7 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
 
   if (strcmp("Not Modified", TSHttpHdrReasonLookup(TS_HTTP_STATUS_NOT_MODIFIED)) != 0) {
     SDK_RPRINT(test, "TSHttpHdrReasonLookup", "TestCase2", TC_FAIL,
-               "TSHttpHdrReasonLookup returns TS_ERROR or Value's mismatch");
+               "TSHttpHdrReasonLookup returns Value's mismatch");
     if (test_passed_Http_Hdr_Reason_Lookup == true) {
       test_passed_Http_Hdr_Reason_Lookup = false;
     }
@@ -3462,34 +3437,22 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
       bool flag = true;
       // Check the type
       if (flag == true) {
-        TSHttpType type1;
-        TSHttpType type2;
+        TSHttpType type1 = TSHttpHdrTypeGet(bufp1, hdr_loc1);
+        TSHttpType type2 = TSHttpHdrTypeGet(bufp3, hdr_loc3);
 
-        if (((type1 = TSHttpHdrTypeGet(bufp1, hdr_loc1)) == (TSHttpType) TS_ERROR) ||
-            ((type2 = TSHttpHdrTypeGet(bufp3, hdr_loc3)) == (TSHttpType) TS_ERROR)) {
-          SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "TSHttpTypeGet returns TS_ERROR.");
+        if (type1 != type2) {
+          SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "Type mismatch in both headers");
           flag = false;
-        } else {
-          if (type1 != type2) {
-            SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "Type mismatch in both headers");
-            flag = false;
-          }
         }
       }
       // Check the Version
       if (flag == true) {
-        int version1;
-        int version2;
+        int version1 = TSHttpHdrVersionGet(bufp1, hdr_loc1);
+        int version2 = TSHttpHdrVersionGet(bufp3, hdr_loc3);
 
-        if (((version1 = TSHttpHdrVersionGet(bufp1, hdr_loc1)) == TS_ERROR) ||
-            ((version2 = TSHttpHdrVersionGet(bufp3, hdr_loc3)) == TS_ERROR)) {
-          SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "TSHttpVersionGet returns TS_ERROR");
+        if (version1 != version2) {
+          SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "Version mismatch in both headers");
           flag = false;
-        } else {
-          if (version1 != version2) {
-            SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "Version mismatch in both headers");
-            flag = false;
-          }
         }
       }
       // Check the Method
@@ -3540,15 +3503,11 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
           }
           // URL Port
           if (flag == true) {
-            if (((port1 = TSUrlPortGet(bufp1, url_loc1)) == TS_ERROR) ||
-                ((port2 = TSUrlPortGet(bufp3, url_loc2)) == TS_ERROR)) {
-              SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "TSUrlPortGet returns TS_ERROR");
+            port1 = TSUrlPortGet(bufp1, url_loc1);
+            port2 = TSUrlPortGet(bufp3, url_loc2);
+            if (port1 != port2) {
+              SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "Url Port has different values in both headers");
               flag = false;
-            } else {
-              if (port1 != port2) {
-                SDK_RPRINT(test, "TSHttpHdrCopy", "TestCase1", TC_FAIL, "Url Port has different values in both headers");
-                flag = false;
-              }
             }
           }
           // URL Path
@@ -3592,34 +3551,22 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
       bool flag = true;
       // Check the type
       if (flag == true) {
-        TSHttpType type1;
-        TSHttpType type2;
+        TSHttpType type1 = TSHttpHdrTypeGet(bufp1, hdr_loc1);
+        TSHttpType type2 = TSHttpHdrTypeGet(bufp4, hdr_loc4);
 
-        if (((type1 = TSHttpHdrTypeGet(bufp1, hdr_loc1)) == (TSHttpType) TS_ERROR) ||
-            ((type2 = TSHttpHdrTypeGet(bufp4, hdr_loc4)) == (TSHttpType) TS_ERROR)) {
-          SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "TSHttpTypeGet returns TS_ERROR.");
+        if (type1 != type2) {
+          SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "Type mismatch in both headers");
           flag = false;
-        } else {
-          if (type1 != type2) {
-            SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "Type mismatch in both headers");
-            flag = false;
-          }
         }
       }
       // Check the Version
       if (flag == true) {
-        int version1;
-        int version2;
+        int version1 = TSHttpHdrVersionGet(bufp1, hdr_loc1);
+        int version2 = TSHttpHdrVersionGet(bufp4, hdr_loc4);
 
-        if (((version1 = TSHttpHdrVersionGet(bufp1, hdr_loc1)) == TS_ERROR) ||
-            ((version2 = TSHttpHdrVersionGet(bufp4, hdr_loc4)) == TS_ERROR)) {
-          SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "TSHttpVersionGet returns TS_ERROR");
+        if (version1 != version2) {
+          SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "Version mismatch in both headers");
           flag = false;
-        } else {
-          if (version1 != version2) {
-            SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "Version mismatch in both headers");
-            flag = false;
-          }
         }
       }
       // Check the Method
@@ -3670,15 +3617,11 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
           }
           // URL Port
           if (flag == true) {
-            if (((port1 = TSUrlPortGet(bufp1, url_loc1)) == TS_ERROR) ||
-                ((port2 = TSUrlPortGet(bufp4, url_loc2)) == TS_ERROR)) {
-              SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "TSUrlPortGet returns TS_ERROR");
+            port1 = TSUrlPortGet(bufp1, url_loc1);
+            port2 = TSUrlPortGet(bufp4, url_loc2);
+            if (port1 != port2) {
+              SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "Url Port has different values in both headers");
               flag = false;
-            } else {
-              if (port1 != port2) {
-                SDK_RPRINT(test, "TSHttpHdrClone", "TestCase1", TC_FAIL, "Url Port has different values in both headers");
-                flag = false;
-              }
             }
           }
           // URL Path
@@ -3716,70 +3659,65 @@ REGRESSION_TEST(SDK_API_TSHttpHdr) (Regr
 
   //LengthGet
   if (test_passed_Http_Hdr_Create == true) {
-    if ((actual_length = TSHttpHdrLengthGet(bufp1, hdr_loc1)) == TS_ERROR) {
-      SDK_RPRINT(test, "TSHttpHdrLengthGet", "TestCase1", TC_FAIL, "TSHttpHdrLengthGet returns TS_ERROR");
+    actual_length = TSHttpHdrLengthGet(bufp1, hdr_loc1);
+    TSIOBuffer iobuf = TSIOBufferCreate();
+    TSHttpHdrPrint(bufp1, hdr_loc1, iobuf);
+    TSIOBufferReader iobufreader = TSIOBufferReaderAlloc(iobuf);
+
+    expected_length = TSIOBufferReaderAvail(iobufreader);
+    if (actual_length == expected_length) {
+      SDK_RPRINT(test, "TSHttpHdrLengthGet", "TestCase1", TC_PASS, "ok");
+      test_passed_Http_Hdr_Length = true;
     } else {
-      TSIOBuffer iobuf = TSIOBufferCreate();
-      TSHttpHdrPrint(bufp1, hdr_loc1, iobuf);
-      TSIOBufferReader iobufreader = TSIOBufferReaderAlloc(iobuf);
-      if ((expected_length = TSIOBufferReaderAvail(iobufreader)) == TS_ERROR) {
-        SDK_RPRINT(test, "TSHttpHdrLengthGet", "TestCase1", TC_FAIL, "Cannot calculate the length to be expected.");
-      } else {
-        if (actual_length == expected_length) {
-          SDK_RPRINT(test, "TSHttpHdrLengthGet", "TestCase1", TC_PASS, "ok");
-          test_passed_Http_Hdr_Length = true;
-        } else {
-          SDK_RPRINT(test, "TSHttpHdrLengthGet", "TestCase1", TC_FAIL, "Incorrect value returned.");
-        }
-      }
+      SDK_RPRINT(test, "TSHttpHdrLengthGet", "TestCase1", TC_FAIL, "Incorrect value returned.");
+    }
 
-      // Print.
-      if ((test_passed_Http_Hdr_Method == true) && (test_passed_Http_Hdr_Url == true) &&
-          (test_passed_Http_Hdr_Version == true) && (test_passed_Http_Hdr_Length == true) &&
-          (try_print_function == true)) {
-        char *actual_iobuf = NULL;
+    // Print.
+    if ((test_passed_Http_Hdr_Method == true) && (test_passed_Http_Hdr_Url == true) &&
+        (test_passed_Http_Hdr_Version == true) && (test_passed_Http_Hdr_Length == true) &&
+        (try_print_function == true)) {
+      char *actual_iobuf = NULL;
 
-        actual_iobuf = (char *) TSmalloc((actual_length + 1) * sizeof(char));
+      actual_iobuf = (char *) TSmalloc((actual_length + 1) * sizeof(char));
 
-        if (actual_iobuf == NULL) {
-          SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_FAIL, "Unable to allocate memory");
-        } else {
+      if (actual_iobuf == NULL) {
+        SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_FAIL, "Unable to allocate memory");
+      } else {
 
-          TSIOBufferBlock iobufblock;
-          int64_t bytes_read;
+        TSIOBufferBlock iobufblock;
+        int64_t bytes_read;
 
-          memset(actual_iobuf, 0, (actual_length + 1) * sizeof(char));
-          bytes_read = 0;
+        memset(actual_iobuf, 0, (actual_length + 1) * sizeof(char));
+        bytes_read = 0;
 
-          iobufblock = TSIOBufferReaderStart(iobufreader);
+        iobufblock = TSIOBufferReaderStart(iobufreader);
 
-          while (iobufblock != NULL) {
-            const char *block_start;
-            int64_t block_size;
-
-            block_start = TSIOBufferBlockReadStart(iobufblock, iobufreader, &block_size);
-            if (block_size <= 0)
-              break;
-
-            memcpy(actual_iobuf + bytes_read, block_start, block_size);
-            bytes_read += block_size;
-            TSIOBufferReaderConsume(iobufreader, block_size);
-            iobufblock = TSIOBufferReaderStart(iobufreader);
-          }
-          if (strcmp(actual_iobuf, expected_iobuf) == 0) {
-            SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_PASS, "ok");
-            test_passed_Http_Hdr_Print = true;
-          } else {
-            SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_FAIL, "Value's mismatch");
-          }
+        while (iobufblock != NULL) {
+          const char *block_start;
+          int64_t block_size;
 
-          TSfree(actual_iobuf);
-          TSIOBufferReaderFree(iobufreader);
-          TSIOBufferDestroy(iobuf);
+          block_start = TSIOBufferBlockReadStart(iobufblock, iobufreader, &block_size);
+          if (block_size <= 0)
+            break;
+
+          memcpy(actual_iobuf + bytes_read, block_start, block_size);
+          bytes_read += block_size;
+          TSIOBufferReaderConsume(iobufreader, block_size);
+          iobufblock = TSIOBufferReaderStart(iobufreader);
         }
-      } else {
-        SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_FAIL, "Unable to run test for TSHttpHdrPrint");
+        if (strcmp(actual_iobuf, expected_iobuf) == 0) {
+          SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_PASS, "ok");
+          test_passed_Http_Hdr_Print = true;
+        } else {
+          SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_FAIL, "Value's mismatch");
+        }
+
+        TSfree(actual_iobuf);
+        TSIOBufferReaderFree(iobufreader);
+        TSIOBufferDestroy(iobuf);
       }
+    } else {
+      SDK_RPRINT(test, "TSHttpHdrPrint", "TestCase1", TC_FAIL, "Unable to run test for TSHttpHdrPrint");
     }
   } else {
     SDK_RPRINT(test, "TSHttpHdrLengthGet", "All Test Cases", TC_PASS, "Cannot run test as TSHttpHdrCreate has failed");
@@ -4060,7 +3998,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrField) 
   // TSMimeHdrCreate
   if (test_passed_MBuffer_Create == true) {
     if (TSMimeHdrCreate(bufp1, &mime_loc1) != TS_SUCCESS) {
-      SDK_RPRINT(test, "TSMimeHdrCreate", "TestCase1", TC_FAIL, "TSMimeHdrCreate Returns TS_ERROR_PTR");
+      SDK_RPRINT(test, "TSMimeHdrCreate", "TestCase1", TC_FAIL, "TSMimeHdrCreate Returns TS_ERROR");
     } else {
       SDK_RPRINT(test, "TSMimeHdrCreate", "TestCase1", TC_PASS, "ok");
       test_passed_Mime_Hdr_Create = true;
@@ -4076,7 +4014,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrField) 
         (TSMimeHdrFieldCreate(bufp1, mime_loc1, &field_loc13) != TS_SUCCESS) ||
         (TSMimeHdrFieldCreate(bufp1, mime_loc1, &field_loc14) != TS_SUCCESS) ||
         (TSMimeHdrFieldCreate(bufp1, mime_loc1, &field_loc15) != TS_SUCCESS)) {
-      SDK_RPRINT(test, "TSMimeHdrFieldCreate", "TestCase1|2|3|4|5", TC_FAIL, "TSMimeHdrFieldCreate Returns TS_ERROR_PTR");
+      SDK_RPRINT(test, "TSMimeHdrFieldCreate", "TestCase1|2|3|4|5", TC_FAIL, "TSMimeHdrFieldCreate Returns TS_ERROR");
     } else {
       SDK_RPRINT(test, "TSMimeHdrFieldCreate", "TestCase1|2|3|4|5", TC_PASS, "ok");
       test_passed_Mime_Hdr_Field_Create = true;
@@ -4093,7 +4031,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrField) 
         (TSMimeHdrFieldNameSet(bufp1, mime_loc1, field_loc13, field3Name, -1) == TS_ERROR) ||
         (TSMimeHdrFieldNameSet(bufp1, mime_loc1, field_loc14, field4Name, -1) == TS_ERROR) ||
         (TSMimeHdrFieldNameSet(bufp1, mime_loc1, field_loc15, field5Name, -1) == TS_ERROR)) {
-      SDK_RPRINT(test, "TSMimeHdrFieldNameSet", "TestCase1|2|3|4|5", TC_FAIL, "TSMimeHdrFieldNameSet Returns TS_ERROR_PTR");
+      SDK_RPRINT(test, "TSMimeHdrFieldNameSet", "TestCase1|2|3|4|5", TC_FAIL, "TSMimeHdrFieldNameSet Returns TS_ERROR");
     } else {
       field1NameGet = TSMimeHdrFieldNameGet(bufp1, mime_loc1, field_loc11, &field1NameGetLength);
       field2NameGet = TSMimeHdrFieldNameGet(bufp1, mime_loc1, field_loc12, &field2NameGetLength);
@@ -4748,10 +4686,10 @@ REGRESSION_TEST(SDK_API_TSHttpHdrParse) 
   int retval;
 
   TSMBuffer reqbufp;
-  TSMBuffer respbufp = (TSMBuffer) TS_ERROR_PTR;
+  TSMBuffer respbufp = (TSMBuffer)NULL;
 
-  TSMLoc req_hdr_loc = (TSMLoc) TS_ERROR_PTR;
-  TSMLoc resp_hdr_loc = (TSMLoc) TS_ERROR_PTR;
+  TSMLoc req_hdr_loc = (TSMLoc)NULL;
+  TSMLoc resp_hdr_loc = (TSMLoc)NULL;
 
   TSHttpParser parser;
 
@@ -4996,16 +4934,16 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
 
   TSMimeParser parser;
 
-  TSMBuffer bufp1 = (TSMBuffer) TS_ERROR_PTR;
-  TSMBuffer bufp2 = (TSMBuffer) TS_ERROR_PTR;
-  TSMBuffer bufp3 = (TSMBuffer) TS_ERROR_PTR;
-
-  TSMLoc mime_hdr_loc1 = (TSMLoc) TS_ERROR_PTR;
-  TSMLoc mime_hdr_loc2 = (TSMLoc) TS_ERROR_PTR;
-  TSMLoc mime_hdr_loc3 = (TSMLoc) TS_ERROR_PTR;
+  TSMBuffer bufp1 = (TSMBuffer)NULL;
+  TSMBuffer bufp2 = (TSMBuffer)NULL;
+  TSMBuffer bufp3 = (TSMBuffer)NULL;
+
+  TSMLoc mime_hdr_loc1 = (TSMLoc)NULL;
+  TSMLoc mime_hdr_loc2 = (TSMLoc)NULL;
+  TSMLoc mime_hdr_loc3 = (TSMLoc)NULL;
 
-  TSMLoc field_loc1 = (TSMLoc) TS_ERROR_PTR;
-  TSMLoc field_loc2 = (TSMLoc) TS_ERROR_PTR;
+  TSMLoc field_loc1 = (TSMLoc)NULL;
+  TSMLoc field_loc2 = (TSMLoc)NULL;
 
   const char *start;
   const char *end;
@@ -5031,12 +4969,8 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
 
   //Create Parser
   parser = TSMimeParserCreate();
-  if (parser == TS_ERROR_PTR) {
-    SDK_RPRINT(test, "TSMimeParserCreate", "TestCase1", TC_FAIL, "TSMimeParserCreate returns TS_ERROR_PTR");
-  } else {
-    SDK_RPRINT(test, "TSMimeParserCreate", "TestCase1", TC_PASS, "ok");
-    test_passed_parser_create = true;
-  }
+  SDK_RPRINT(test, "TSMimeParserCreate", "TestCase1", TC_PASS, "ok");
+  test_passed_parser_create = true;
 
   if (test_passed_parser_create == true) {
     // Parsing
@@ -5064,15 +4998,12 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
             SDK_RPRINT(test, "TSMimeHdrPrint", "TestCase1", TC_PASS, "ok");
 
             // TSMimeHdrLengthGet
-            if ((hdrLength = TSMimeHdrLengthGet(bufp1, mime_hdr_loc1)) == TS_ERROR) {
-              SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, "TSMimeHdrLengthGet returns TS_ERROR");
+            hdrLength = TSMimeHdrLengthGet(bufp1, mime_hdr_loc1);
+            if (hdrLength == (int) strlen(temp)) {
+              SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_PASS, "ok");
+              test_passed_mime_hdr_length_get = true;
             } else {
-              if (hdrLength == (int) strlen(temp)) {
-                SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_PASS, "ok");
-                test_passed_mime_hdr_length_get = true;
-              } else {
-                SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, "Value's Mismatch");
-              }
+              SDK_RPRINT(test, "TSMimeHdrLengthGet", "TestCase1", TC_FAIL, "Value's Mismatch");
             }
 
             test_passed_parse = true;
@@ -5149,7 +5080,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
         test_passed_handle_mloc_release = true;
       }
 
-      if ((field_loc2 != NULL) && (field_loc2 != TS_ERROR_PTR)) {
+      if (field_loc2 != NULL) {
         if (TSHandleMLocRelease(bufp1, mime_hdr_loc1, field_loc2) == TS_ERROR) {
           SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase2", TC_FAIL, "TSHandleMLocRelease returns TS_ERROR");
           test_passed_handle_mloc_release = false;
@@ -5228,7 +5159,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
         SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase3", TC_PASS, "ok");
       }
 
-      if ((field_loc2 != NULL) && (field_loc2 != TS_ERROR_PTR)) {
+      if (field_loc2 != NULL) {
         if (TSHandleMLocRelease(bufp2, mime_hdr_loc2, field_loc2) == TS_ERROR) {
           SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase4", TC_FAIL, "TSHandleMLocRelease returns TS_ERROR");
           test_passed_handle_mloc_release = false;
@@ -5268,7 +5199,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
         SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase5", TC_PASS, "ok");
       }
 
-      if ((field_loc2 != NULL) && (field_loc2 != TS_ERROR_PTR)) {
+      if (field_loc2 != NULL) {
         if (TSHandleMLocRelease(bufp1, mime_hdr_loc1, field_loc2) == TS_ERROR) {
           SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase6", TC_FAIL, "TSHandleMLocRelease returns TS_ERROR");
           test_passed_handle_mloc_release = false;
@@ -5289,7 +5220,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
       SDK_RPRINT(test, "TSMimeHdrFieldClone", "TestCase1", TC_FAIL, "Unable to get source field for copying");
     } else {
       if (TSMimeHdrFieldClone(bufp3, mime_hdr_loc3, bufp1, mime_hdr_loc1, field_loc2, &field_loc1) != TS_SUCCESS) {
-        SDK_RPRINT(test, "TSMimeHdrFieldClone", "TestCase1", TC_FAIL, "TSMimeHdrFieldClone returns TS_ERROR_PTR");
+        SDK_RPRINT(test, "TSMimeHdrFieldClone", "TestCase1", TC_FAIL, "TSMimeHdrFieldClone returns TS_ERROR");
       } else {
         if ((compare_field_names(test, bufp3, mime_hdr_loc3, field_loc1, bufp1, mime_hdr_loc1, field_loc2) == TS_ERROR) ||
             (compare_field_values(test, bufp3, mime_hdr_loc3, field_loc1, bufp1, mime_hdr_loc1, field_loc2, true) == TS_ERROR)) {
@@ -5299,7 +5230,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
         }
       }
     }
-    if ((field_loc1 != NULL) && (field_loc1 != TS_ERROR_PTR)) {
+    if (field_loc1 != NULL) {
       if (TSHandleMLocRelease(bufp3, mime_hdr_loc3, field_loc1) == TS_ERROR) {
         SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase7", TC_FAIL, "TSHandleMLocRelease returns TS_ERROR");
         test_passed_handle_mloc_release = false;
@@ -5308,7 +5239,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
       }
     }
 
-    if ((field_loc2 != NULL) && (field_loc2 != TS_ERROR_PTR)) {
+    if (field_loc2 != NULL) {
       if (TSHandleMLocRelease(bufp1, mime_hdr_loc1, field_loc2) == TS_ERROR) {
         SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase8", TC_FAIL, "TSHandleMLocRelease returns TS_ERROR");
         test_passed_handle_mloc_release = false;
@@ -5346,7 +5277,7 @@ REGRESSION_TEST(SDK_API_TSMimeHdrParse) 
         SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase9", TC_PASS, "ok");
       }
 
-      if ((field_loc2 != NULL) && (field_loc2 != TS_ERROR_PTR)) {
+      if (field_loc2 != NULL) {
         if (TSHandleMLocRelease(bufp1, mime_hdr_loc1, field_loc2) == TS_ERROR) {
           SDK_RPRINT(test, "TSHandleMLocRelease", "TestCase10", TC_FAIL, "TSHandleMLocRelease returns TS_ERROR");
           test_passed_handle_mloc_release = false;
@@ -5414,7 +5345,7 @@ REGRESSION_TEST(SDK_API_TSUrlParse) (Reg
   int retval;
 
   TSMBuffer bufp;
-  TSMLoc url_loc = (TSMLoc) TS_ERROR_PTR;
+  TSMLoc url_loc = (TSMLoc)NULL;
   bool test_passed_parse_url = false;
   int length;
 
@@ -6106,8 +6037,8 @@ ssn_handler(TSCont contp, TSEvent event,
 
   TSHttpTxn txnp = NULL;
   ContData *data = NULL;
-  data = (ContData *) TSContDataGet(contp);
-  if ((data == TS_ERROR_PTR) || (data == NULL)) {
+  data = (ContData *)TSContDataGet(contp);
+  if (data == NULL) {
     switch (event) {
     case TS_EVENT_HTTP_SSN_START:
       TSHttpSsnReenable((TSHttpSsn) edata, TS_EVENT_HTTP_CONTINUE);
@@ -6239,7 +6170,7 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_HttpSs
   *pstatus = REGRESSION_TEST_INPROGRESS;
 
   TSCont cont = TSContCreate(ssn_handler, TSMutexCreate());
-  if ((cont == NULL) || (cont == TS_ERROR_PTR)) {
+  if (cont == NULL) {
     SDK_RPRINT(test, "TSHttpSsn", "TestCase1", TC_FAIL, "Unable to create Continuation.");
     *pstatus = REGRESSION_TEST_FAILED;
     return;
@@ -6302,9 +6233,9 @@ cache_hook_handler(TSCont contp, TSEvent
 {
 
   TSHttpTxn txnp = NULL;
-  CacheTestData *data = NULL;
-  data = (CacheTestData *) TSContDataGet(contp);
-  if ((data == TS_ERROR_PTR) || (data == NULL)) {
+  CacheTestData *data = (CacheTestData *)TSContDataGet(contp);
+
+  if (data == NULL) {
     switch (event) {
     case TS_EVENT_IMMEDIATE:
     case TS_EVENT_TIMEOUT:
@@ -6470,7 +6401,8 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_HttpTx
   *pstatus = REGRESSION_TEST_INPROGRESS;
 
   TSCont cont = TSContCreate(cache_hook_handler, TSMutexCreate());
-  if ((cont == NULL) || (cont == TS_ERROR_PTR)) {
+
+  if (cont == NULL) {
     SDK_RPRINT(test, "TSHttpSsn", "TestCase1", TC_FAIL, "Unable to create Continuation.");
     *pstatus = REGRESSION_TEST_FAILED;
     return;
@@ -6778,7 +6710,7 @@ transform_add(TSHttpTxn txnp, TransformT
 
   connp = TSTransformCreate(transformtest_transform, txnp);
   TSContDataSet(connp, data);
-  if ((connp == NULL) || (connp == TS_ERROR_PTR)) {
+  if (connp == NULL) {
     SDK_RPRINT(data->test, "TSHttpTxnTransform", "", TC_FAIL, "Unable to create Transformation.");
     return;
   }
@@ -6818,7 +6750,7 @@ transform_hook_handler(TSCont contp, TSE
   TSHttpTxn txnp = NULL;
   TransformTestData *data = NULL;
   data = (TransformTestData *) TSContDataGet(contp);
-  if ((data == TS_ERROR_PTR) || (data == NULL)) {
+  if (data == NULL) {
     switch (event) {
     case TS_EVENT_IMMEDIATE:
     case TS_EVENT_TIMEOUT:
@@ -7042,7 +6974,7 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_HttpTx
   Debug(UTDBG_TAG "_transform", "Starting test");
 
   TSCont cont = TSContCreate(transform_hook_handler, TSMutexCreate());
-  if ((cont == NULL) || (cont == TS_ERROR_PTR)) {
+  if (cont == NULL) {
     SDK_RPRINT(test, "TSHttpSsn", "TestCase1", TC_FAIL, "Unable to create Continuation.");
     *pstatus = REGRESSION_TEST_FAILED;
     return;
@@ -7123,7 +7055,7 @@ altinfo_hook_handler(TSCont contp, TSEve
   TSHttpTxn txnp = NULL;
 
   data = (AltInfoTestData *) TSContDataGet(contp);
-  if ((data == TS_ERROR_PTR) || (data == NULL)) {
+  if (data == NULL) {
     switch (event) {
     case TS_EVENT_IMMEDIATE:
     case TS_EVENT_TIMEOUT:
@@ -7283,7 +7215,7 @@ EXCLUSIVE_REGRESSION_TEST(SDK_API_HttpAl
   *pstatus = REGRESSION_TEST_INPROGRESS;
 
   TSCont cont = TSContCreate(altinfo_hook_handler, TSMutexCreate());
-  if ((cont == NULL) || (cont == TS_ERROR_PTR)) {
+  if (cont == NULL) {
     SDK_RPRINT(test, "TSHttpSsn", "TestCase1", TC_FAIL, "Unable to create Continuation.");
     *pstatus = REGRESSION_TEST_FAILED;
     return;

Modified: trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc?rev=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkIOCoreAPI.cc Thu Feb 17 03:13:24 2011
@@ -40,8 +40,13 @@
 #include "I_HostDB.h"
 
 // This assert is for internal API use only.
+#if TS_USE_FAST_SDK
+#define sdk_assert(EX) (void)(EX)
+#else
 #define sdk_assert(EX)                                          \
   (void)((EX) || (_TSReleaseAssert(#EX, __FILE__, __LINE__)))
+#endif
+
 
 TSReturnCode
 sdk_sanity_check_mutex(TSMutex mutex)

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=1071494&r1=1071493&r2=1071494&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h.in (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h.in Thu Feb 17 03:13:24 2011
@@ -559,8 +559,6 @@ extern "C"
       TS_THREAD_POOL_UDP
     } TSThreadPool;
 
-  extern tsapi const void *TS_ERROR_PTR;
-
   typedef int64_t TSHRTime;
 
   /* These typedefs are used with the corresponding TSMgmt*Get functions
@@ -2207,7 +2205,6 @@ extern "C"
 
       @param contp continuation called to handle the interception.
       @param txnp transaction to be intercepted.
-      @return TS_SUCCESS on success, TS_ERROR on failure.
 
    */
   tsapi void TSHttpTxnIntercept(TSCont contp, TSHttpTxn txnp);
@@ -2241,7 +2238,6 @@ extern "C"
 
       @param contp continuation called to handle the interception
       @param txnp transaction to be intercepted.
-      @return TS_SUCCESS on success, TS_ERROR on failure.
 
    */
   tsapi void TSHttpTxnServerIntercept(TSCont contp, TSHttpTxn txnp);
@@ -2263,7 +2259,6 @@ extern "C"
       @param log_port port (in network byte order) that connection will
         be logged as coming from.
       @param vc will be set to point to the new TSVConn on success.
-      @return TS_SUCCESS on success, TS_ERROR on failure.
 
    */
   tsapi TSVConn TSHttpConnect(unsigned int log_ip, int log_port);



Mime
View raw message