if (*p == '\0') {
if (*p == '\0' || (q - proto_str) <= 1) {
int url_open(URLContext **puc, const char *filename, int flags){    URLContext *uc;    URLProtocol *up;    const char *p;    char proto_str[128], *q;    int err;    p = filename;    q = proto_str;    while (*p != '\0' && *p != ':') {        if ((q - proto_str) < sizeof(proto_str) - 1)            *q++ = *p;        p++;    }    if (*p == '\0') {        strcpy(proto_str, "file");    } else {        *q = '\0';    }        up = first_protocol;    while (up != NULL) {        if (!strcmp(proto_str, up->name))             goto found;        up = up->next;    }    return -ENOENT; found:    uc = malloc(sizeof(URLContext));    if (!uc)        return -ENOMEM;    uc->prot = up;    uc->flags = flags;    uc->is_streamed = 0; /* default = not streamed */    uc->packet_size = 1; /* default packet size */    err = up->url_open(uc, filename, flags);    if (err < 0) {        free(uc);        *puc = NULL;        return err;    }    *puc = uc;    return 0;}