X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=diffcore-pickaxe.c;h=929de15aa9228099b3a772be788d746e440a9e8c;hb=452c6d506b1a6dcf24d4ceaa592afc39c1c1a60e;hp=574b3e833711fe3794636b86dbf2b9d9deb5e151;hpb=c0250b6477d2edf58d0a7bc229bfa4f720c1cd58;p=git.git diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c index 574b3e833..929de15aa 100644 --- a/diffcore-pickaxe.c +++ b/diffcore-pickaxe.c @@ -25,10 +25,12 @@ static unsigned int contains(struct diff_filespec *one, regmatch_t regmatch; int flags = 0; + assert(data[sz] == '\0'); while (*data && !regexec(regexp, data, 1, ®match, flags)) { flags |= REG_NOTBOL; - data += regmatch.rm_so; - if (*data) data++; + data += regmatch.rm_eo; + if (*data && regmatch.rm_so == regmatch.rm_eo) + data++; cnt++; } @@ -53,8 +55,7 @@ void diffcore_pickaxe(const char *needle, int opts) int i, has_changes; regex_t regex, *regexp = NULL; struct diff_queue_struct outq; - outq.queue = NULL; - outq.nr = outq.alloc = 0; + DIFF_QUEUE_CLEAR(&outq); if (opts & DIFF_PICKAXE_REGEX) { int err;