Blob
- Date:
- Message:
- fix clang 3.4 warnings and ignore uninteresting ones fixed warnings: src/cmd/fossil/disk.c:37:14: warning: use of GNU 'missing =' extension in designator [-Wgnu-designator] src/cmd/fossil/disk.c:38:14: warning: use of GNU 'missing =' extension in designator [-Wgnu-designator] src/cmd/fossil/disk.c:39:14: warning: use of GNU 'missing =' extension in designator [-Wgnu-designator] src/cmd/fossil/disk.c:40:13: warning: use of GNU 'missing =' extension in designator [-Wgnu-designator] src/cmd/fossil/disk.c:41:14: warning: use of GNU 'missing =' extension in designator [-Wgnu-designator] src/libndb/ndbreorder.c:41:55: warning: for loop has empty body [-Wempty-body] ignored warnings: src/cmd/acid/dbg.y:393:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/bc.y:1327:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/bc.y:1327:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/grep/grep.y:420:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/grep/grep.y:420:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/hoc/hoc.y:692:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/hoc/hoc.y:692:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/lex/parser.y:886:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/rc/syn.y:303:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/cmd/units.y:1003:9: warning: array index -1 is before the beginning of the array [-Warray-bounds] src/libregexp/regcomp.c:19:16: warning: variable 'reprog' is not needed and will not be emitted [-Wunneeded-internal-declaration] LGTM=rsc R=rsc https://codereview.appspot.com/158250043
- Actions:
- History | Blame | Raw File
1 #include <u.h>2 #include <libc.h>3 #include <bio.h>4 #include <ndb.h>6 /*7 * reorder the tuple to put x's line first in the entry and x fitst in its line8 */9 Ndbtuple*10 ndbreorder(Ndbtuple *t, Ndbtuple *x)11 {12 Ndbtuple *nt;13 Ndbtuple *last, *prev;15 /* if x is first, we're done */16 if(x == t)17 return t;19 /* find end of x's line */20 for(last = x; last->line == last->entry; last = last->line)21 ;23 /* rotate to make this line first */24 if(last->line != t){26 /* detach this line and everything after it from the entry */27 for(nt = t; nt->entry != last->line; nt = nt->entry)28 ;29 nt->entry = nil;31 /* switch */32 for(nt = last; nt->entry != nil; nt = nt->entry)33 ;34 nt->entry = t;35 }37 /* rotate line to make x first */38 if(x != last->line){40 /* find entry before x */41 for(prev = last; prev->line != x; prev = prev->line)42 ;44 /* detach line */45 nt = last->entry;46 last->entry = last->line;48 /* reattach */49 prev->entry = nt;50 }52 return x;53 }