aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib/strdup.c
diff options
context:
space:
mode:
authordeshevoy <deshevoy@yandex-team.ru>2022-02-10 16:46:57 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:57 +0300
commit28148f76dbfcc644d96427d41c92f36cbf2fdc6e (patch)
treeb83306b6e37edeea782e9eed673d89286c4fef35 /contrib/libs/curl/lib/strdup.c
parente988f30484abe5fdeedcc7a5d3c226c01a21800c (diff)
downloadydb-28148f76dbfcc644d96427d41c92f36cbf2fdc6e.tar.gz
Restoring authorship annotation for <deshevoy@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/curl/lib/strdup.c')
-rw-r--r--contrib/libs/curl/lib/strdup.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/contrib/libs/curl/lib/strdup.c b/contrib/libs/curl/lib/strdup.c
index c827afae434..9af47ea4734 100644
--- a/contrib/libs/curl/lib/strdup.c
+++ b/contrib/libs/curl/lib/strdup.c
@@ -19,17 +19,17 @@
* KIND, either express or implied.
*
***************************************************************************/
-
+
#include "curl_setup.h"
-#include <curl/curl.h>
-
+#include <curl/curl.h>
+
#include "strdup.h"
-#include "curl_memory.h"
+#include "curl_memory.h"
+
+/* The last #include file should be: */
+#include "memdebug.h"
-/* The last #include file should be: */
-#include "memdebug.h"
-
#ifndef HAVE_STRDUP
char *curlx_strdup(const char *str)
{
@@ -49,47 +49,47 @@ char *curlx_strdup(const char *str)
return newstr;
}
#endif
-
-/***************************************************************************
- *
- * Curl_memdup(source, length)
- *
- * Copies the 'source' data to a newly allocated buffer (that is
- * returned). Copies 'length' bytes.
- *
- * Returns the new pointer or NULL on failure.
- *
- ***************************************************************************/
-void *Curl_memdup(const void *src, size_t length)
-{
- void *buffer = malloc(length);
- if(!buffer)
- return NULL; /* fail */
-
- memcpy(buffer, src, length);
-
- return buffer;
-}
-
-/***************************************************************************
- *
- * Curl_saferealloc(ptr, size)
- *
- * Does a normal realloc(), but will free the data pointer if the realloc
- * fails. If 'size' is non-zero, it will free the data and return a failure.
- *
- * This convenience function is provided and used to help us avoid a common
- * mistake pattern when we could pass in a zero, catch the NULL return and end
- * up free'ing the memory twice.
- *
- * Returns the new pointer or NULL on failure.
- *
- ***************************************************************************/
-void *Curl_saferealloc(void *ptr, size_t size)
-{
- void *datap = realloc(ptr, size);
- if(size && !datap)
- /* only free 'ptr' if size was non-zero */
- free(ptr);
- return datap;
-}
+
+/***************************************************************************
+ *
+ * Curl_memdup(source, length)
+ *
+ * Copies the 'source' data to a newly allocated buffer (that is
+ * returned). Copies 'length' bytes.
+ *
+ * Returns the new pointer or NULL on failure.
+ *
+ ***************************************************************************/
+void *Curl_memdup(const void *src, size_t length)
+{
+ void *buffer = malloc(length);
+ if(!buffer)
+ return NULL; /* fail */
+
+ memcpy(buffer, src, length);
+
+ return buffer;
+}
+
+/***************************************************************************
+ *
+ * Curl_saferealloc(ptr, size)
+ *
+ * Does a normal realloc(), but will free the data pointer if the realloc
+ * fails. If 'size' is non-zero, it will free the data and return a failure.
+ *
+ * This convenience function is provided and used to help us avoid a common
+ * mistake pattern when we could pass in a zero, catch the NULL return and end
+ * up free'ing the memory twice.
+ *
+ * Returns the new pointer or NULL on failure.
+ *
+ ***************************************************************************/
+void *Curl_saferealloc(void *ptr, size_t size)
+{
+ void *datap = realloc(ptr, size);
+ if(size && !datap)
+ /* only free 'ptr' if size was non-zero */
+ free(ptr);
+ return datap;
+}