src/pEp_string.h
author Volker Birk <vb@pep.foundation>
Mon, 15 Jan 2018 12:23:56 +0100
changeset 2377 008d02a90566
parent 2376 997e80887f22
child 2378 b244047cdacc
permissions -rw-r--r--
typo
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #pragma once
     5 
     6 #include <string.h>
     7 #include "dynamic_api.h"
     8 
     9 #ifdef __cplusplus
    10 extern "C" {
    11 #endif
    12 
    13 
    14 // new_string() - allocate a new string
    15 //
    16 //  parameters:
    17 //      src (in)        string to copy or NULL
    18 //      len (in)        length of newly created string or 0 for default
    19 //
    20 //  return value:
    21 //      pointer to string object or NULL if out of memory
    22 //
    23 //  caveat:
    24 //      one of the two parameters has to be set at least
    25 
    26 DYNAMIC_API char * new_string(const char *src, size_t len);
    27 
    28 
    29 // free_string() - free memory occupied by string
    30 //
    31 //  parameters:
    32 //      s (in)          pointer to string to free
    33 
    34 DYNAMIC_API void free_string(char *s);
    35 
    36 
    37 // string_dup() - duplicate a string
    38 //
    39 //  parameters:
    40 //      src (in)        string to duplicate
    41 //      len (in)        length of newly created string or 0 for default
    42 //
    43 //  return value:
    44 //      pointer to copy or NULL if out of memory
    45 
    46 DYNAMIC_API char * string_dup(const char *src, size_t len);
    47 
    48 
    49 #ifdef __cplusplus
    50 }
    51 #endif
    52