/* Read key of 'type' into 'key' and return the current 'type' pointer.  */
static char* key_get_info(const char *type, char **key)
/* Read key of 'type' into 'key' and return the current 'type' pointer.  */
static char* key_get_info(const char *type, char **key)
{
    size_t len;
    char *p, *str;
    if (*type == ',')
        type++;
    p = strchr(type, ':');
    if (!p) {
        *key = NULL;
        return NULL;
    }
    len = p - type;
    str = g_malloc(len + 1);
    memcpy(str, type, len);
    str[len] = '\0';
    *key = str;
    return ++p;
}