History

20070608-1149

Charles.Forsyth committed 19 years ago

Commit 2da3ec41 parent 24a543914 files · +34 −15Browse files

Unified · Split

14 files
  1. CHANGES +2 −0
  2. appl/cmd/9export.b +0 −1
  3. appl/cmd/install/logs.b +1 −1
  4. dis/9export.dis +0 −0
  5. dis/install/logs.dis +0 −0
  6. include/version.h +1 −1
  7. lib9/fmtdef.h +4 −0
  8. lib9/fmtprint.c +4 −2
  9. lib9/fmtvprint.c +6 −3
  10. lib9/runevseprint.c +2 −1
  11. lib9/vfprint.c +2 −1
  12. lib9/vseprint.c +2 −1
  13. lib9/vsmprint.c +10 −5
  14. lib9/vsnprint.c +2 −1
CHANGES+2−0
@@ -1,3 +1,5 @@
1+20070608
2+ update /lib9 functions to use silly va_copy (and then va_end) instead of just assigning, to account for silly C implementations
13 20070607
24 /appl/wm/man.b /appl/lib/man.b to allow 10.1 etc as section references
35 20070605
appl/cmd/9export.b+0−1
@@ -38,7 +38,6 @@ init(nil: ref Draw->Context, args: list of string) · 37 unmodified lines
3838
3939 arg->init(args);
4040 arg->setusage("9export [-aA9] [-k keyspec] [-e enc digest]");
41− flags := 0;
4241 cryptalg := ""; # will be rc4_256 sha1
4342 keyspec := "";
4443 noauth := 0;
appl/cmd/install/logs.b+1−1
@@ -122,7 +122,7 @@ contents(e: ref Entry): string · 121 unmodified lines
122122 s := "";
123123 for(cl := e.contents; cl != nil; cl = tl cl)
124124 s += " " + hd cl;
125− return s[1:];
125+ return s; # includes initial space
126126 }
127127
128128 Entry.text(e: self ref Entry): string
dis/9export.dis+0−0

Binary file not shown.

dis/install/logs.dis+0−0

Binary file not shown.

include/version.h+1−1
@@ -1 +1 @@
1−#define VERSION "Fourth Edition (20070607)"
1+#define VERSION "Fourth Edition (20070608)"
lib9/fmtdef.h+4−0
@@ -96,3 +96,7 @@ void _fmtunlock(void); · 95 unmodified lines
9696 t += runetochar(t, &_rune);\
9797 }\
9898 }while(0)
99+
100+#ifndef va_copy
101+#define va_copy(a, b) ((a) = (b))
102+#endif
lib9/fmtprint.c+4−2
@@ -29,14 +29,16 @@ fmtprint(Fmt *f, char *fmt, ...) · 28 unmodified lines
2929 f->flags = 0;
3030 f->width = 0;
3131 f->prec = 0;
32− va = f->args;
32+ va_copy(va, f->args);
33+ va_end(f->args);
3334 va_start(f->args, fmt);
3435 n = dofmt(f, fmt);
3536 va_end(f->args);
3637 f->flags = 0;
3738 f->width = 0;
3839 f->prec = 0;
39− f->args = va;
40+ va_copy(f->args, va);
41+ va_end(va);
4042 if(n >= 0)
4143 return 0;
4244 return n;
lib9/fmtvprint.c+6−3
@@ -29,13 +29,16 @@ fmtvprint(Fmt *f, char *fmt, va_list args) · 28 unmodified lines
2929 f->flags = 0;
3030 f->width = 0;
3131 f->prec = 0;
32− va = f->args;
33− f->args = args;
32+ va_copy(va, f->args);
33+ va_end(f->args);
34+ va_copy(f->args, args);
3435 n = dofmt(f, fmt);
3536 f->flags = 0;
3637 f->width = 0;
3738 f->prec = 0;
38− f->args = va;
39+ va_end(f->args);
40+ va_copy(f->args, va);
41+ va_end(va);
3942 if(n >= 0)
4043 return 0;
4144 return n;
lib9/runevseprint.c+2−1
@@ -14,8 +14,9 @@ runevseprint(Rune *buf, Rune *e, char *fmt, va_list args) · 13 unmodified lines
1414 f.flush = nil;
1515 f.farg = nil;
1616 f.nfmt = 0;
17− f.args = args;
17+ va_copy(f.args, args);
1818 dofmt(&f, fmt);
19+ va_end(f.args);
1920 *(Rune*)f.to = '\0';
2021 return f.to;
2122 }
lib9/vfprint.c+2−1
@@ -38,8 +38,9 @@ vfprint(int fd, char *fmt, va_list args) · 37 unmodified lines
3838 int n;
3939
4040 fmtfdinit(&f, fd, buf, sizeof(buf));
41− f.args = args;
41+ va_copy(f.args, args);
4242 n = dofmt(&f, fmt);
43+ va_end(f.args);
4344 if(n > 0 && _fmtFdFlush(&f) == 0)
4445 return -1;
4546 return n;
lib9/vseprint.c+2−1
@@ -27,8 +27,9 @@ vseprint(char *buf, char *e, char *fmt, va_list args) · 26 unmodified lines
2727 f.flush = nil;
2828 f.farg = nil;
2929 f.nfmt = 0;
30− f.args = args;
30+ va_copy(f.args, args);
3131 dofmt(&f, fmt);
32+ va_end(f.args);
3233 *(char*)f.to = '\0';
3334 return f.to;
3435 }
lib9/vsmprint.c+10−5
@@ -20,6 +20,8 @@ fmtStrFlush(Fmt *f) · 19 unmodified lines
2020 char *s;
2121 int n;
2222
23+ if(f->start == nil)
24+ return 0;
2325 n = (int)f->farg;
2426 n += 256;
2527 f->farg = (void*)n;
@@ -41,7 +43,7 @@ fmtstrinit(Fmt *f) · 15 unmodified lines
4143 {
4244 int n;
4345
44− f->runes = 0;
46+ memset(f, 0, sizeof(*f));
4547 n = 32;
4648 f->start = malloc(n);
4749 if(f->start == nil)
@@ -65,10 +67,13 @@ vsmprint(char *fmt, va_list args) · 17 unmodified lines
6567
6668 if(fmtstrinit(&f) < 0)
6769 return nil;
68− f.args = args;
70+ va_copy(f.args, args);
6971 n = dofmt(&f, fmt);
70− if(n < 0)
72+ va_end(f.args);
73+ if(n < 0){
74+ free(f.start);
75+ f.start = nil;
7176 return nil;
72− *(char*)f.to = '\0';
73− return f.start;
77+ }
78+ return fmtstrflush(&f);
7479 }
lib9/vsnprint.c+2−1
@@ -27,8 +27,9 @@ vsnprint(char *buf, int len, char *fmt, va_list args) · 26 unmodified lines
2727 f.flush = nil;
2828 f.farg = nil;
2929 f.nfmt = 0;
30− f.args = args;
30+ va_copy(f.args, args);
3131 dofmt(&f, fmt);
32+ va_end(f.args);
3233 *(char*)f.to = '\0';
3334 return (char*)f.to - buf;
3435 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t