src/pEp_string.h
author Krista 'DarthMama' Bennett <krista@pep.foundation>
Tue, 30 Jun 2020 14:56:25 +0200
branchdoxygen_doc
changeset 4792 7056435ab9e7
parent 2440 3c45fce3ef40
child 5015 fd39cb7d93eb
permissions -rw-r--r--
some doxygen stuff. might not be kept.
     1 /** @file */
     2 /** @brief File description for doxygen missing. FIXME */
     3 
     4 // This file is under GNU General Public License 3.0
     5 // see LICENSE.txt
     6 
     7 #pragma once
     8 
     9 #include <string.h>
    10 #include "dynamic_api.h"
    11 
    12 #ifdef __cplusplus
    13 extern "C" {
    14 #endif
    15 
    16 
    17 // new_string() - allocate a new string
    18 //
    19 //  parameters:
    20 //      src (in)        string to copy or NULL
    21 //      len (in)        length of newly created string or 0 for default
    22 //
    23 //  return value:
    24 //      pointer to string object or NULL if out of memory
    25 //
    26 //  calling with str and len is equivalent to strndup()
    27 //  calling with str but len=0 is equivalent to strdup()
    28 //  calling with str=NULL is equivalent to calloc()
    29 
    30 DYNAMIC_API char * new_string(const char *src, size_t len);
    31 
    32 
    33 // free_string() - free memory occupied by string
    34 //
    35 //  parameters:
    36 //      s (in)          pointer to string to free
    37 
    38 DYNAMIC_API void free_string(char *s);
    39 
    40 
    41 // string_dup() - duplicate a string
    42 //
    43 //  parameters:
    44 //      src (in)        string to duplicate
    45 //      len (in)        length of newly created string or 0 for default
    46 //
    47 //  return value:
    48 //      pointer to copy or NULL if out of memory
    49 
    50 DYNAMIC_API char * string_dup(const char *src, size_t len);
    51 
    52 
    53 #ifdef __cplusplus
    54 }
    55 #endif
    56