diff options
author | Russ Cox <rsc@swtch.com> | 2011-01-02 16:01:05 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2011-01-02 16:01:05 -0500 |
commit | 839c052a938f78fde18b9b2431c24c6163e4a7f3 (patch) | |
tree | 42934eec9170f8ffb9af23e52891109216726802 /src/cmd/acid | |
parent | b567422f98b815a45fa8e7144057a8834e98616b (diff) | |
download | plan9port-839c052a938f78fde18b9b2431c24c6163e4a7f3.tar.gz plan9port-839c052a938f78fde18b9b2431c24c6163e4a7f3.tar.bz2 plan9port-839c052a938f78fde18b9b2431c24c6163e4a7f3.zip |
acid: 4-byte Runes
R=rsc
http://codereview.appspot.com/3860041
Diffstat (limited to 'src/cmd/acid')
-rw-r--r-- | src/cmd/acid/exec.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/cmd/acid/exec.c b/src/cmd/acid/exec.c index 2022da53..c6b07842 100644 --- a/src/cmd/acid/exec.c +++ b/src/cmd/acid/exec.c @@ -205,7 +205,7 @@ convflt(Node *r, char *flt) void indir(Map *m, ulong addr, char fmt, Node *r) { - int i; + int i, j, k; u32int ival; u64int vval; int ret; @@ -280,16 +280,19 @@ indir(Map *m, ulong addr, char fmt, Node *r) break; case 'R': r->type = TSTRING; - for(i = 0; i < sizeof(buf)-2; i += 2) { - ret = get1(m, addr, (uchar*)&buf[i], 2); + assert(sizeof(Rune) == 4); + for(i = 0; i < sizeof(buf)-4; i += 4) { + ret = get4(m, addr, &ival); if (ret < 0) error("indir: %r"); - addr += 2; - if(buf[i] == 0 && buf[i+1] == 0) + rval = ival; + memmove(buf+i, &ival, 4); + addr += 4; + if(ival == 0) break; } - buf[i++] = 0; - buf[i] = 0; + ival = 0; + memmove(buf+i, &ival, 4); r->store.u.string = runenode((Rune*)buf); break; case 'i': |