openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/krb5/1.17-r0/krb5-1.17/src/lib/gssapi/krb5/error_map.h
static inline int gsserrmap_replace_or_insert(struct gsserrmap__head* head,
                                              OM_uint32 key, char* new_value)
{
    struct gsserrmap__element* e = gsserrmap__find_node(head, key);
    int ret;

    if (e)
    {
        /* replace */
        void (*free_value)(char*) = free_string;
        if (free_value)
            (*free_value)(e->value);
        e->value = new_value;
    }
    else
    {
        /* insert */
        e = malloc(sizeof(*e));
        if (e == NULL)
            return ENOMEM;
        ret = gsserrmap__copy_key(&e->key, key);
        if (ret)
        {
            free(e);
            return ret;
        }
        e->value = new_value;
        e->next = head->first;
        head->first = e;
    }
    return 0;
}
/* Returns 0 or error code.  */
Returns 0 or error code.
Returns 0 or error code .
static inline int gsserrmap_replace_or_insert(struct gsserrmap__head* head,
                                              OM_uint32 key, char* new_value)
{
    struct gsserrmap__element* e = gsserrmap__find_node(head, key);
    int ret;
    if (e)
    {
        void (*free_value)(char*) = free_string;
        if (free_value)
            (*free_value)(e->value);
        e->value = new_value;
    }
    else
    {
        e = malloc(sizeof(*e));
        if (e == NULL)
            return ENOMEM;
        ret = gsserrmap__copy_key(&e->key, key);
        if (ret)
        {
            free(e);
            return ret;
        }
        e->value = new_value;
        e->next = head->first;
        head->first = e;
    }
    return 0;
}
static inline int gsserrmap_replace_or_insert ( struct gsserrmap__head * head , OM_uint32 key , char * new_value ) { struct gsserrmap__element * e = gsserrmap__find_node ( head , key ) ; int ret ; if ( e ) { void ( * free_value ) ( char * ) = free_string ; if ( free_value ) ( * free_value ) ( e -> value ) ; e -> value = new_value ; } else { e = malloc ( sizeof ( * e ) ) ; if ( e == NULL ) return ENOMEM ; ret = gsserrmap__copy_key ( & e -> key , key ) ; if ( ret ) { free ( e ) ; return ret ; } e -> value = new_value ; e -> next = head -> first ; head -> first = e ; } return 0 ; }
Returns 0 or error code.
Returns 0 or error code .
/* replace */ /* insert */