# HG changeset patch # User Erik Quanstrom # Date 1329519108 0 # Node ID 00051c3d3125358716d3de95381f18231ce15cbf # Parent d5c3a985ece44b36bd0bb86aeae6c0400e1666f4 runes: use UTFmax as the maximum number of bytes per rune use the symbolic constant UTFmax as the maximum number of bytes per rune, rather than "3". R=nixiedev, nemo, john CC=nix-dev http://codereview.appspot.com/5672064 Committer: John Floren diff -r d5c3a985ece4 -r 00051c3d3125 sys/src/nix/port/chan.c --- a/sys/src/nix/port/chan.c Fri Feb 17 22:36:42 2012 +0000 +++ b/sys/src/nix/port/chan.c Fri Feb 17 22:51:48 2012 +0000 @@ -1171,7 +1171,7 @@ if(name <= aname) panic("bad math in namelenerror"); /* walk out of current UTF sequence */ - for(i=0; (*name&0xC0)==0x80 && i<3; i++) + for(i=0; (*name&0xC0)==0x80 && igenbuf, sizeof up->genbuf, "...%.*s", diff -r d5c3a985ece4 -r 00051c3d3125 sys/src/nix/port/dev.c --- a/sys/src/nix/port/dev.c Fri Feb 17 22:36:42 2012 +0000 +++ b/sys/src/nix/port/dev.c Fri Feb 17 22:51:48 2012 +0000 @@ -131,7 +131,7 @@ c->dev = devtabget(dc, 0); if(spec == nil) spec = ""; - buf = smalloc(4+strlen(spec)+1); + buf = smalloc(1+UTFmax+strlen(spec)+1); sprint(buf, "#%C%s", dc, spec); c->path = newpath(buf); free(buf);