Created
March 7, 2011 21:29
-
-
Save cosimo/859274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Per Buer's code, "Re: Lots of configs" | |
* http://pastebin.com/a68y15hp | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
#include <pcre.h> | |
int main() { | |
const char *error; | |
int erroffset; | |
pcre *re; | |
int rc; | |
int i; | |
char str[] = "www.ibm.com"; | |
int ovector[30]; | |
int runs = 10000000; | |
int n; | |
re = pcre_compile ( "^www\\.ibm\\.com", | |
0, &error, &erroffset, 0); | |
if (!re) { | |
printf("pcre_compile failed (offset: %d), %s\n", erroffset, error); | |
return -1; | |
} | |
printf("Running %i matches....\n", runs); | |
for (n=0; n < runs; n++) | |
rc = pcre_exec (re, 0, str, strlen(str), | |
0, 0, ovector, 30); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment