Ejemplo n.º 1
0
Archivo: node.c Proyecto: lucemia/r3
inline edge * r3_node_find_edge_str(const node * n, const char * str, int str_len) {
    unsigned short i = 0;
    char firstbyte = *str;
    for (; i < n->edge_len ; i++ ) {
        if ( firstbyte == *(n->edges[i]->pattern) ) {
            info("matching '%s' with '%s'\n", str, node_edge_pattern(n,i) );
            if ( strncmp( node_edge_pattern(n,i), str, node_edge_pattern_len(n,i) ) == 0 ) {
                return n->edges[i];
            }
            return NULL;
        }
    }
    return NULL;
}
Ejemplo n.º 2
0
Archivo: node.c Proyecto: SciTeX/r3
inline edge * r3_node_find_edge_str(node * n, char * str, int str_len) {
    int i = 0;
    int matched_idx = 0;

    for (; i < n->edge_len ; i++ ) {
        if ( *str == *(n->edges[i]->pattern) ) {
            matched_idx = i;
            break;
        }
    }

    info("matching '%s' with '%s'\n", str, node_edge_pattern(n,i) );
    if ( strncmp( node_edge_pattern(n,matched_idx), str, node_edge_pattern_len(n,matched_idx) ) == 0 ) {
        return n->edges[matched_idx];
    }
    return NULL;
}