mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-06 05:02:40 +03:00
httplib_strdup() now global
This commit is contained in:
@@ -21,4 +21,6 @@ The function `httplib_strcasecmp()` is a helper function to compare two strings.
|
||||
|
||||
### See Also
|
||||
|
||||
* [`httplib_strdup();`](httplib_strdup.md)
|
||||
* [`httplib_strncasecmp();`](httplib_strncasecmp.md)
|
||||
* [`httplib_strndup();`](httplib_strndup.md)
|
||||
|
30
doc/api/httplib_strdup.md
Normal file
30
doc/api/httplib_strdup.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# LibHTTP API Reference
|
||||
|
||||
### `httplib_strdup( str );`
|
||||
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| :--- | :--- | :--- |
|
||||
|**`str`**|`const char *`|Pointer to the source string which must be duplicated|
|
||||
|
||||
### Return Value
|
||||
|
||||
| Type | Description |
|
||||
| :--- | :--- |
|
||||
|`char *`|Pointer to the duplicate, or NULL if an error occured|
|
||||
|
||||
### Description
|
||||
|
||||
The function `httplib_strdup()` duplicates a NUL terminated string to a new string. The duplicate is stored in a newly allocated block of memory. The function is equivalent to the Posix `strdup()` function with the difference that the LibHTTP memory allocation functions are used which allow for tracking of allocation requests and memory leaks through a monitor hook.
|
||||
|
||||
If the duplicate of the string is no longer used, the allocated memory should be returned to the heap with a call to [`httplib_free()`](httplib_free.md).
|
||||
|
||||
If the function fails the value `NULL` is returned, otherwise a pointer to the duplicate.
|
||||
|
||||
### See Also
|
||||
|
||||
* [`httplib_free();`](httplib_free.md)
|
||||
* [`httplib_strcasecmp();`](httplib_strcasecmp.md)
|
||||
* [`httplib_strncasecmp();`](httplib_strncasecmp.md)
|
||||
* [`httplib_strndup();`](httplib_strndup.md)
|
@@ -23,3 +23,5 @@ The function `httplib_strncasecmp()` is a helper function to compare two strings
|
||||
### See Also
|
||||
|
||||
* [`httplib_strcasecmp();`](httplib_strcasecmp.md)
|
||||
* [`httplib_strdup();`](httplib_strdup.md)
|
||||
* [`httplib_strndup();`](httplib_strndup.md)
|
||||
|
@@ -27,4 +27,5 @@ If the function fails the value `NULL` is returned, otherwise a pointer to the d
|
||||
|
||||
* [`httplib_free();`](httplib_free.md)
|
||||
* [`httplib_strcasecmp();`](httplib_strcasecmp.md)
|
||||
* [`httplib_strdup();`](httplib_strdup.md)
|
||||
* [`httplib_strncasecmp();`](httplib_strncasecmp.md)
|
||||
|
Reference in New Issue
Block a user