use 64 * 3 bytes instead of 220 bytes for combined pattern
This commit is contained in:
parent
fbe3fb66b1
commit
c18c466a9b
2 changed files with 10 additions and 10 deletions
|
@ -623,3 +623,5 @@
|
|||
1447155699,13781189.15,5851252.25,62601.55,2539751.33
|
||||
1447156053,13415522.24,5930072.07,82241.25,2533834.67
|
||||
1447156073,13492327.24,5848589.68,52428.80,2567896.99
|
||||
1447156411,13229275.90,5858750.37,66576.25,2523350.73
|
||||
1447156432,13556025.90,5873947.56,62601.55,2487130.01
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 447.
|
16
src/node.c
16
src/node.c
|
@ -173,26 +173,24 @@ int r3_tree_compile(node *n, char **errstr)
|
|||
* Return 0 if success
|
||||
*/
|
||||
int r3_tree_compile_patterns(node * n, char **errstr) {
|
||||
char * cpat;
|
||||
edge * e = NULL;
|
||||
char * p;
|
||||
|
||||
cpat = zcalloc(sizeof(char) * 220); // XXX
|
||||
char * cpat = zcalloc(sizeof(char) * 64 * 3); // XXX
|
||||
if (!cpat) {
|
||||
asprintf(errstr, "Can not allocate memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = cpat;
|
||||
|
||||
edge *e = NULL;
|
||||
int opcode_cnt = 0;
|
||||
for ( int i = 0 ; i < n->edge_len ; i++ ) {
|
||||
int i = 0;
|
||||
for (; i < n->edge_len ; i++) {
|
||||
e = n->edges[i];
|
||||
|
||||
if ( e->opcode )
|
||||
if (e->opcode) {
|
||||
opcode_cnt++;
|
||||
}
|
||||
|
||||
if ( e->has_slug ) {
|
||||
if (e->has_slug) {
|
||||
// compile "foo/{slug}" to "foo/[^/]+"
|
||||
char * slug_pat = r3_slug_compile(e->pattern, e->pattern_len);
|
||||
strcat(p, slug_pat);
|
||||
|
|
Loading…
Reference in a new issue