r109208 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109207‎ | r109208 | r109209 >
Date:20:11, 17 January 2012
Author:ben
Status:ok
Tags:
Comment:
retabbing to eliminate mixed spaces and tabs
Modified paths:
  • /trunk/udplog/filters/SOPA-filter.c (modified) (history)

Diff [purge]

Index: trunk/udplog/filters/SOPA-filter.c
@@ -3,22 +3,22 @@
44 #include <string.h>
55
66 char * urls[] = {
7 - "en.wikipedia.org/wiki/Special:CongressLookup",
 7+ "en.wikipedia.org/wiki/Special:CongressLookup",
88 };
99
1010 main() {
11 - char line[65534];
 11+ char line[65534];
1212 char *t = 0;
13 -
14 - int i = 0;
15 -
16 - //calculate these up-front.
17 - int filtercount = sizeof(urls)/sizeof(*urls);
18 - int url_length[filtercount];
19 - for (i=0; i<filtercount; ++i){
20 - url_length[i] = strlen(urls[i]);
21 - }
2213
 14+ int i = 0;
 15+
 16+ //calculate these up-front.
 17+ int filtercount = sizeof(urls)/sizeof(*urls);
 18+ int url_length[filtercount];
 19+ for (i=0; i<filtercount; ++i){
 20+ url_length[i] = strlen(urls[i]);
 21+ }
 22+
2323 while (!feof(stdin)) {
2424 char *r;
2525 r=fgets(line, 65534, stdin);
@@ -36,23 +36,23 @@
3737 }
3838 if (!t)
3939 continue;
40 -
41 - t = strstr(t, "://");
42 - if (!t)
43 - continue;
44 - t += 3;
45 -
46 - int found = 0;
47 - for (i = 0; i < filtercount; ++i) {
48 - if (strncmp(t, urls[i], url_length[i]) == 0) {
49 - found = 1;
50 - break;
51 - }
52 - }
53 - if (found) {
54 - printf("%s", line);
55 - }
5640
 41+ t = strstr(t, "://");
 42+ if (!t)
 43+ continue;
 44+ t += 3;
 45+
 46+ int found = 0;
 47+ for (i = 0; i < filtercount; ++i) {
 48+ if (strncmp(t, urls[i], url_length[i]) == 0) {
 49+ found = 1;
 50+ break;
 51+ }
 52+ }
 53+ if (found) {
 54+ printf("%s", line);
 55+ }
 56+
5757 }
5858
5959 }

Status & tagging log