re2_c.cxx
/* Record captures per match in captures_r vector. 
 * captures_r vector will be realloceted automatically. */
Record captures per match in captures_r vector.
captures_r vector will be realloceted automatically.
Record captures per match in captures_r vector . captures_r vector will be realloceted automatically .
unsigned
re2c_record_capture(struct re2c_match_aux* aux) {
    if (unlikely(!aux->captures))
        return 0;
    if (!aux->captures_r) {
        aux->captures_r = new re2::StringPiece[CAP_VECTOR_DEFAULT_LEN];
        if (!aux->captures_r) return 1;
    }
    if (aux->cap_r_vect_len + aux->cap_vect_len >= aux->cap_r_vect_max_len) {
        aux->cap_r_vect_max_len *= 2;
        re2::StringPiece *new_captures_r = new re2::StringPiece[aux->cap_r_vect_max_len];
        if (!new_captures_r)
            return 1;
        for (int i = 0; i < aux->cap_r_vect_len; i++) {
            new_captures_r[i] = aux->captures_r[i];
        }
        delete[] aux->captures_r;
        aux->captures_r = new_captures_r;
    }
    for (int i = 0; i < aux->ncap; i++) {
        aux->captures_r[aux->cap_r_vect_len] = aux->captures[i];
        aux->cap_r_vect_len++;
    }
    return 0;
}
unsigned re2c_record_capture ( struct re2c_match_aux * aux ) { if ( unlikely ( ! aux -> captures ) ) return 0 ; if ( ! aux -> captures_r ) { aux -> captures_r = new re2 :: StringPiece [ CAP_VECTOR_DEFAULT_LEN ] ; if ( ! aux -> captures_r ) return 1 ; } if ( aux -> cap_r_vect_len + aux -> cap_vect_len >= aux -> cap_r_vect_max_len ) { aux -> cap_r_vect_max_len *= 2 ; re2 :: StringPiece * new_captures_r = new re2 :: StringPiece [ aux -> cap_r_vect_max_len ] ; if ( ! new_captures_r ) return 1 ; for ( int i = 0 ; i < aux -> cap_r_vect_len ; i ++ ) { new_captures_r [ i ] = aux -> captures_r [ i ] ; } delete [ ] aux -> captures_r ; aux -> captures_r = new_captures_r ; } for ( int i = 0 ; i < aux -> ncap ; i ++ ) { aux -> captures_r [ aux -> cap_r_vect_len ] = aux -> captures [ i ] ; aux -> cap_r_vect_len ++ ; } return 0 ; }
Record captures per match in captures_r vector.
Record captures per match in captures_r vector .