Azure IoT common library

Dependents:   STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more

Revision:
21:b92006c5b9ff
Parent:
19:2e0811512ceb
Child:
25:8507bf644fdf
diff -r 95abdea56064 -r b92006c5b9ff strings.c
--- a/strings.c	Fri Feb 10 17:01:36 2017 -0800
+++ b/strings.c	Fri Feb 24 14:01:41 2017 -0800
@@ -16,6 +16,7 @@
 //
 
 #include "azure_c_shared_utility/strings.h"
+#include "azure_c_shared_utility/optimize_size.h"
 #include "azure_c_shared_utility/xlogging.h"
 
 static const char hexToASCII[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
@@ -366,7 +367,7 @@
     if ((handle == NULL) || (s2 == NULL))
     {
         /* Codes_SRS_STRING_07_013: [STRING_concat shall return a nonzero number if an error is encountered.] */
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -377,7 +378,7 @@
         if (temp == NULL)
         {
             /* Codes_SRS_STRING_07_013: [STRING_concat shall return a nonzero number if an error is encountered.] */
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -399,7 +400,7 @@
     if ((s1 == NULL) || (s2 == NULL))
     {
         /* Codes_SRS_STRING_07_035: [String_Concat_with_STRING shall return a nonzero number if an error is encountered.] */
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -412,7 +413,7 @@
         if (temp == NULL)
         {
             /* Codes_SRS_STRING_07_035: [String_Concat_with_STRING shall return a nonzero number if an error is encountered.] */
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -435,7 +436,7 @@
     if ((handle == NULL) || (s2 == NULL))
     {
         /* Codes_SRS_STRING_07_017: [STRING_copy shall return a nonzero value if any of the supplied parameters are NULL.] */
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -448,7 +449,7 @@
             if (temp == NULL)
             {
                 /* Codes_SRS_STRING_07_027: [STRING_copy shall return a nonzero value if any error is encountered.] */
-                result = __LINE__;
+                result = __FAILURE__;
             }
             else
             {
@@ -476,7 +477,7 @@
     if ((handle == NULL) || (s2 == NULL))
     {
         /* Codes_SRS_STRING_07_019: [STRING_copy_n shall return a nonzero value if STRING_HANDLE or const char* is NULL.] */
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -492,7 +493,7 @@
         if (temp == NULL)
         {
             /* Codes_SRS_STRING_07_028: [STRING_copy_n shall return a nonzero value if any error is encountered.] */
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -521,8 +522,8 @@
     if (handle == NULL || format == NULL)
     {
         /* Codes_SRS_STRING_07_042: [if the parameters s1 or format are NULL then STRING_sprintf shall return non zero value.] */
-        result = __LINE__;
         LogError("Invalid arg (NULL)");
+        result = __FAILURE__;
     }
     else
     {
@@ -535,8 +536,8 @@
         if (s2Length < 0)
         {
             /* Codes_SRS_STRING_07_043: [If any error is encountered STRING_sprintf shall return a non zero value.] */
-            result = __LINE__;
             LogError("Failure vsnprintf return < 0");
+            result = __FAILURE__;
         }
         else if (s2Length == 0)
         {
@@ -558,7 +559,7 @@
                     /* Codes_SRS_STRING_07_043: [If any error is encountered STRING_sprintf shall return a non zero value.] */
                     LogError("Failure vsnprintf formatting error");
                     s1->s[s1Length] = '\0';
-                    result = __LINE__;
+                    result = __FAILURE__;
                 }
                 else
                 {
@@ -571,7 +572,7 @@
             {
                 /* Codes_SRS_STRING_07_043: [If any error is encountered STRING_sprintf shall return a non zero value.] */
                 LogError("Failure unable to reallocate memory");
-                result = __LINE__;
+                result = __FAILURE__;
             }
         }
     }
@@ -588,7 +589,7 @@
     if (handle == NULL)
     {
         /* Codes_SRS_STRING_07_015: [STRING_quote shall return a nonzero value if any of the supplied parameters are NULL.] */
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -598,7 +599,7 @@
         if (temp == NULL)
         {
             /* Codes_SRS_STRING_07_029: [STRING_quote shall return a nonzero value if any error is encountered.] */
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {
@@ -621,7 +622,7 @@
     if (handle == NULL)
     {
         /* Codes_SRS_STRING_07_023: [STRING_empty shall return a nonzero value if the STRING_HANDLE is NULL.] */
-        result = __LINE__;
+        result = __FAILURE__;
     }
     else
     {
@@ -630,7 +631,7 @@
         if (temp == NULL)
         {
             /* Codes_SRS_STRING_07_030: [STRING_empty shall return a nonzero value if the STRING_HANDLE is NULL.] */
-            result = __LINE__;
+            result = __FAILURE__;
         }
         else
         {