keygen/src/json_tools.c
/**
 * ep_new_json_str() - Allocate a new string based on a json string
 * @j_str: The JSON string to copy
 *
 * Caller must free returned buffer.
 *
 * Return: A newly allocated buffer with the json string copied inside or NULL if j_str is not a string type
 */
Allocate a new string based on a json string
@j_str: The JSON string to copy

Caller must free returned buffer.

A newly allocated buffer with the json string copied inside or NULL if j_str is not a string type
Allocate a new string based on a json string @j_str : The JSON string to copy Caller must free returned buffer . A newly allocated buffer with the json string copied inside or NULL if j_str is not a string type
char *new_json_str(json_t *j_str)
{
    const char *src = json_string_value(j_str);
    char *dst = NULL;
    if (src) {
        dst = malloc(strlen(src) + 1);
        strcpy(dst, src);
    }
    return dst;
}
char * new_json_str ( json_t * j_str ) { const char * src = json_string_value ( j_str ) ; char * dst = NULL ; if ( src ) { dst = malloc ( strlen ( src ) + 1 ) ; strcpy ( dst , src ) ; } return dst ; }
ep_new_json_str() - Allocate a new string based on a json string
 @j_str: The JSON string to copy
ep_new_json_str () - Allocate a new string based on a json string @j_str : The JSON string to copy