diff options
author | Dan Cross <cross@gajendra.net> | 2020-01-10 14:44:21 +0000 |
---|---|---|
committer | Dan Cross <cross@gajendra.net> | 2020-01-10 14:54:30 +0000 |
commit | fa325e9b42b0bdfb48857d1958d9fb7ceac55151 (patch) | |
tree | 81d26256d152435135bcb1ae43121979a49f5f2b /src/cmd/smugfs | |
parent | 77a0a5b5194d4441c86de097f2aae297cb75e2c2 (diff) | |
download | plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.gz plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.bz2 plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.zip |
Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines.
Remove blank lines from the ends of files.
Change modes on source files so that they
are not executable.
Signed-off-by: Dan Cross <cross@gajendra.net>
Diffstat (limited to 'src/cmd/smugfs')
-rw-r--r-- | src/cmd/smugfs/a.h | 1 | ||||
-rw-r--r-- | src/cmd/smugfs/cache.c | 14 | ||||
-rw-r--r-- | src/cmd/smugfs/download.c | 6 | ||||
-rw-r--r-- | src/cmd/smugfs/fs.c | 100 | ||||
-rw-r--r-- | src/cmd/smugfs/http.c | 8 | ||||
-rw-r--r-- | src/cmd/smugfs/icache.c | 9 | ||||
-rw-r--r-- | src/cmd/smugfs/json.c | 20 | ||||
-rw-r--r-- | src/cmd/smugfs/jsonrpc.c | 11 | ||||
-rw-r--r-- | src/cmd/smugfs/log.c | 1 | ||||
-rw-r--r-- | src/cmd/smugfs/main.c | 6 | ||||
-rw-r--r-- | src/cmd/smugfs/openssl.c | 8 | ||||
-rw-r--r-- | src/cmd/smugfs/tcp.c | 1 | ||||
-rw-r--r-- | src/cmd/smugfs/util.c | 9 |
13 files changed, 94 insertions, 100 deletions
diff --git a/src/cmd/smugfs/a.h b/src/cmd/smugfs/a.h index fa65002d..4b42f140 100644 --- a/src/cmd/smugfs/a.h +++ b/src/cmd/smugfs/a.h @@ -187,4 +187,3 @@ enum }; extern int printerrors; - diff --git a/src/cmd/smugfs/cache.c b/src/cmd/smugfs/cache.c index 2adf8b9b..afce6ba7 100644 --- a/src/cmd/smugfs/cache.c +++ b/src/cmd/smugfs/cache.c @@ -78,14 +78,14 @@ static void movetofront(Cache *c, CEntry *e) { popout(c, e); - insertfront(c, e); + insertfront(c, e); } static CEntry* evict(Cache *c) { CEntry *e; - + e = c->tail; popout(c, e); c->cefree(e); @@ -101,7 +101,7 @@ cachelookup(Cache *c, char *name, int create) { int h; CEntry *e; - + h = hash(name) % c->nhash; for(e=c->hash[h]; e; e=e->hash.next){ if(strcmp(name, e->name) == 0){ @@ -109,10 +109,10 @@ cachelookup(Cache *c, char *name, int create) return e; } } - + if(!create) return nil; - + if(c->nentry >= c->maxentry) e = evict(c); else{ @@ -124,7 +124,7 @@ cachelookup(Cache *c, char *name, int create) h = hash(name) % c->nhash; e->hash.next = c->hash[h]; c->hash[h] = e; - return e; + return e; } void @@ -132,7 +132,7 @@ cacheflush(Cache *c, char *substr) { CEntry **l, *e; int i; - + for(i=0; i<c->nhash; i++){ for(l=&c->hash[i]; (e=*l); ){ if(substr == nil || strstr(e->name, substr)){ diff --git a/src/cmd/smugfs/download.c b/src/cmd/smugfs/download.c index e23d49e1..82a2c753 100644 --- a/src/cmd/smugfs/download.c +++ b/src/cmd/smugfs/download.c @@ -13,7 +13,7 @@ static void dfree(CEntry *ce) { DEntry *d; - + d = (DEntry*)ce; if(d->tmpfile){ remove(d->tmpfile); @@ -61,7 +61,7 @@ download(char *url, HTTPHeader *hdr) host = parseurl(url, &path); if(host == nil) return -1; - + d = (DEntry*)cachelookup(downloadcache, url, 1); if(d->tmpfile){ free(host); @@ -81,7 +81,7 @@ download(char *url, HTTPHeader *hdr) fmtprint(&fmt, "User-Agent: " USER_AGENT "\r\n"); fmtprint(&fmt, "\r\n"); req = fmtstrflush(&fmt); - + fprint(2, "Get %s\n", url); if(httptofile(&http, host, req, hdr, fd) < 0){ diff --git a/src/cmd/smugfs/fs.c b/src/cmd/smugfs/fs.c index a57b96d1..47e0a47b 100644 --- a/src/cmd/smugfs/fs.c +++ b/src/cmd/smugfs/fs.c @@ -94,7 +94,7 @@ newupload(SmugFid *sf, char *name) Upload *u; int fd, i; char tmp[] = "/var/tmp/smugfs.XXXXXX"; - + if((fd = opentemp(tmp, ORDWR)) < 0) return nil; qlock(&uploadlock); @@ -192,7 +192,7 @@ getuploadname(SmugFid *sf, char *name) { int i; Upload *u; - + qlock(&uploadlock); for(i=0; i<nup; i++){ u = up[i]; @@ -280,7 +280,7 @@ doupload(Upload *u) } datalen = d->length; free(d); - + memset(&ds, 0, sizeof ds); seek(u->fd, 0, 0); total = 0; @@ -306,7 +306,7 @@ doupload(Upload *u) fmtprint(&fmt, "X-Smug-FileName: %s\r\n", u->name); fmtprint(&fmt, "\r\n"); req = fmtstrflush(&fmt); - + seek(u->fd, 0, 0); jv = jsonupload(&http, UPLOAD_HOST, req, u->fd, datalen); free(req); @@ -330,7 +330,7 @@ nickindex(char *name) { int i; Json *v; - + for(i=0; i<nnick; i++) if(strcmp(nick[i], name) == 0) return i; @@ -354,7 +354,7 @@ void responderrstr(Req *r) { char err[ERRMAX]; - + rerrstr(err, sizeof err); respond(r, err); } @@ -363,7 +363,7 @@ static char* xclone(Fid *oldfid, Fid *newfid) { SmugFid *sf; - + if(oldfid->aux == nil) return nil; @@ -402,7 +402,7 @@ static Json* getcategories(SmugFid *sf) { Json *v, *w; - + v = smug("smugmug.categories.get", "NickName", nickname(sf->nickid), nil); w = jincref(jwalk(v, "Categories")); jclose(v); @@ -413,7 +413,7 @@ static Json* getcategorytree(SmugFid *sf) { Json *v, *w; - + v = smug("smugmug.users.getTree", "NickName", nickname(sf->nickid), nil); w = jincref(jwalk(v, "Categories")); jclose(v); @@ -425,7 +425,7 @@ getcategory(SmugFid *sf, vlong id) { int i; Json *v, *w; - + v = getcategorytree(sf); if(v == nil) return nil; @@ -446,7 +446,7 @@ getcategoryid(SmugFid *sf, char *name) int i; vlong id; Json *v; - + v = getcategories(sf); if(v == nil) return -1; @@ -470,7 +470,7 @@ getcategoryindex(SmugFid *sf, int i) { Json *v; vlong id; - + v = getcategories(sf); if(v == nil) return -1; @@ -510,7 +510,7 @@ getalbums(SmugFid *sf) "NickName", nickname(sf->nickid), nil); w = jincref(jwalk(v, "Albums")); jclose(v); - return w; + return w; } static vlong @@ -520,7 +520,7 @@ getalbumid(SmugFid *sf, char *name, char **keyp) vlong id; Json *v; char *key; - + v = getalbums(sf); if(v == nil) return -1; @@ -548,7 +548,7 @@ getalbumindex(SmugFid *sf, int i, char **keyp) vlong id; Json *v; char *key; - + v = getalbums(sf); if(v == nil) return -1; @@ -591,7 +591,7 @@ getimageid(SmugFid *sf, char *name, char **keyp) Json *v; char *p; char *key; - + id = strtol(name, &p, 10); if(*p != 0 || *name == 0) return -1; @@ -652,7 +652,7 @@ getimageindex(SmugFid *sf, int i, char **keyp) vlong id; Json *v; char *key; - + v = getimages(sf, sf->album, sf->albumkey); if(v == nil) return -1; @@ -677,7 +677,7 @@ categoryname(SmugFid *sf) { Json *v; char *s; - + v = getcategory(sf, sf->category); s = jstring(jwalk(v, "Name")); if(s) @@ -691,7 +691,7 @@ albumname(SmugFid *sf) { Json *v; char *s; - + v = getalbum(sf, sf->album, sf->albumkey); s = jstring(jwalk(v, "Title")); if(s) @@ -705,7 +705,7 @@ imagename(SmugFid *sf) { char *s; Json *v; - + v = getimageinfo(sf, sf->image, sf->imagekey); s = jstring(jwalk(v, "FileName")); if(s && s[0]) @@ -721,7 +721,7 @@ imagelength(SmugFid *sf) { vlong length; Json *v; - + v = getimageinfo(sf, sf->image, sf->imagekey); length = jint(jwalk(v, "Size")); jclose(v); @@ -763,7 +763,7 @@ imageurl(SmugFid *sf) return nil; } -static char* imagestrings[] = +static char* imagestrings[] = { "Caption", "LastUpdated", @@ -786,7 +786,7 @@ static char* imagestrings[] = "Album", }; -static char* albumbools[] = +static char* albumbools[] = { "Public", "Printable", @@ -810,7 +810,7 @@ static char* albumbools[] = "X3Larges", }; -static char* albumstrings[] = +static char* albumstrings[] = { "Description" "Keywords", @@ -866,7 +866,7 @@ readctl(SmugFid *sf) case Qimagectl: v = getimageinfo(sf, sf->image, sf->imagekey); break; - + case Qimageurl: v = getimageinfo(sf, sf->image, sf->imagekey); fmtstrinit(&fmt); @@ -875,11 +875,11 @@ readctl(SmugFid *sf) fmtprint(&fmt, "%s %s\n", urls[i].name, s); jclose(v); return fmtstrflush(&fmt); - + case Qimageexif: v = getimageexif(sf, sf->image, sf->imagekey); break; - + case Qalbumsettings: v = getalbum(sf, sf->album, sf->albumkey); fmtstrinit(&fmt); @@ -946,7 +946,7 @@ dostat(SmugFid *sf, Qid *qid, Dir *dir) char *uid; char *s; vlong length; - + memset(&q, 0, sizeof q); name = nil; freename = 0; @@ -1106,7 +1106,7 @@ xwalk1(Fid *fid, char *name, Qid *qid) SmugFid *sf; char *x; Upload *u; - + dotdot = strcmp(name, "..") == 0; sf = fid->aux; switch(sf->type){ @@ -1157,7 +1157,7 @@ xwalk1(Fid *fid, char *name, Qid *qid) break; } goto NotFound; - + case Qalbums: case Qcategory: if(dotdot){ @@ -1208,7 +1208,7 @@ xwalk1(Fid *fid, char *name, Qid *qid) break; } goto NotFound; - + case Qimage: if(dotdot){ free(sf->imagekey); @@ -1279,7 +1279,7 @@ dodirgen(int i, Dir *d, void *v) xsf.nickid = i; dostat(&xsf, nil, d); return 0; - + case Qnick: if(i-- == 0){ xsf.type = Qalbums; @@ -1292,7 +1292,7 @@ dodirgen(int i, Dir *d, void *v) xsf.category = id; dostat(&xsf, nil, d); return 0; - + case Qalbums: case Qcategory: if((id = getalbumindex(sf, i, &key)) < 0) @@ -1303,7 +1303,7 @@ dodirgen(int i, Dir *d, void *v) dostat(&xsf, nil, d); free(key); return 0; - + case Qalbum: if(i-- == 0){ xsf.type = Qalbumsettings; @@ -1325,7 +1325,7 @@ dodirgen(int i, Dir *d, void *v) dostat(&xsf, nil, d); free(key); return 0; - + case Qimage: if(i-- == 0){ xsf.type = Qimagefile; @@ -1394,13 +1394,13 @@ xwstat(Req *r) } } respond(r, "invalid wstat"); -} +} static void xattach(Req *r) { SmugFid *sf; - + sf = emalloc(sizeof *sf); r->fid->aux = sf; sf->type = Qroot; @@ -1430,7 +1430,7 @@ xopen(Req *r) case Qalbumsettings: case Qimagesettings: break; - + case Quploadfile: if(r->ifcall.mode != OREAD){ lock(&sf->upload->lk); @@ -1444,7 +1444,7 @@ xopen(Req *r) unlock(&sf->upload->lk); } break; - + default: if(r->ifcall.mode != OREAD){ respond(r, "permission denied"); @@ -1492,7 +1492,7 @@ xcreate(Req *r) dostat(sf, &r->ofcall.qid, nil); respond(r, nil); return; - + case Qcategory: // Create new album. if(!(r->ifcall.perm&DMDIR)) @@ -1500,7 +1500,7 @@ xcreate(Req *r) snprint(strid, sizeof strid, "%lld", sf->category); // Start with most restrictive settings. v = ncsmug("smugmug.albums.create", - "Title", r->ifcall.name, + "Title", r->ifcall.name, "CategoryID", strid, "Public", "0", "WorldSearchable", "0", @@ -1526,7 +1526,7 @@ xcreate(Req *r) dostat(sf, &r->ofcall.qid, nil); respond(r, nil); return; - + case Qalbum: // Upload image to album. if(r->ifcall.perm&DMDIR) @@ -1543,14 +1543,14 @@ xcreate(Req *r) respond(r, nil); return; } - respond(r, "permission denied"); + respond(r, "permission denied"); } static int writetofd(Req *r, int fd) { int total, n; - + total = 0; while(total < r->ifcall.count){ n = pwrite(fd, (char*)r->ifcall.data+total, r->ifcall.count-total, r->ifcall.offset+total); @@ -1580,7 +1580,7 @@ xread(Req *r) int fd; HTTPHeader hdr; char *url; - + sf = r->fid->aux; r->ofcall.count = 0; switch(sf->type){ @@ -1640,7 +1640,7 @@ xwrite(Req *r) Json *v; char strid[50]; SmugFid *sf; - + sf = r->fid->aux; r->ofcall.count = r->ifcall.count; sync = (r->ifcall.count==4 && memcmp(r->ifcall.data, "sync", 4) == 0); @@ -1660,7 +1660,7 @@ xwrite(Req *r) respond(r, nil); return; } - break; + break; case Qalbumsctl: case Qcategoryctl: jcacheflush("smugmug.categories.get"); @@ -1740,7 +1740,7 @@ xwrite(Req *r) } respond(r, "invalid control message"); return; -} +} void xremove(Req *r) @@ -1803,7 +1803,7 @@ xremove(Req *r) respond(r, nil); } return; - + case Qimage: snprint(id, sizeof id, "%lld", sf->image); v = ncsmug("smugmug.images.delete", @@ -1832,7 +1832,7 @@ Srv xsrv; void xinit(void) -{ +{ xsrv.attach = xattach; xsrv.open = xopen; xsrv.create = xcreate; diff --git a/src/cmd/smugfs/http.c b/src/cmd/smugfs/http.c index 9cf7f1d0..c6c117fc 100644 --- a/src/cmd/smugfs/http.c +++ b/src/cmd/smugfs/http.c @@ -21,7 +21,7 @@ parseheader(char *buf, int n, HTTPHeader *hdr) { int nline; char *data, *ebuf, *p, *q, *next; - + memset(hdr, 0, sizeof *hdr); ebuf = buf+n; data = haveheader(buf, n); @@ -78,7 +78,7 @@ parseheader(char *buf, int n, HTTPHeader *hdr) q++; strncpy(hdr->codedesc, q, sizeof hdr->codedesc); hdr->codedesc[sizeof hdr->codedesc-1] = 0; - continue; + continue; } q = strchr(p, ':'); if(q == nil) @@ -103,7 +103,7 @@ parseheader(char *buf, int n, HTTPHeader *hdr) memmove(buf, data, ebuf - data); return ebuf - data; -} +} static char* genhttp(Protocol *proto, char *host, char *req, HTTPHeader *hdr, int wfd, int rfd, vlong rtotal) @@ -131,7 +131,7 @@ genhttp(Protocol *proto, char *host, char *req, HTTPHeader *hdr, int wfd, int rf proto->close(fd); return nil; } - + if(rfd >= 0){ while(rtotal > 0){ m = sizeof buf; diff --git a/src/cmd/smugfs/icache.c b/src/cmd/smugfs/icache.c index 750f232c..026aa59e 100644 --- a/src/cmd/smugfs/icache.c +++ b/src/cmd/smugfs/icache.c @@ -30,7 +30,7 @@ icachefind(char *url) { int h; Icache *ic; - + h = hash(url) % NHASH; for(ic=icache.hash[h]; ic; ic=ic->hash){ if(strcmp(ic->url, url) == 0){ @@ -82,7 +82,7 @@ icacheinsert(char *url, HTTPHeader *hdr, char *file, int fd) ic = emalloc(sizeof *ic); icache.n++; } - + ic->url = estrdup(url); ic->fd = dup(fd, -1); ic->file = estrdup(file); @@ -103,7 +103,7 @@ void icacheflush(char *substr) { Icache **l, *ic; - + for(l=&icache.head; (ic=*l); ) { if(substr == nil || strstr(ic->url, substr)) { icache.n--; @@ -116,7 +116,7 @@ icacheflush(char *substr) }else l = &ic->next; } - + if(icache.head) { icache.head->prev = nil; for(ic=icache.head; ic; ic=ic->next){ @@ -168,4 +168,3 @@ urlfetch(char *url, HTTPHeader hdr) icacheinsert(url, &hdr, buf, fd); return fd; } - diff --git a/src/cmd/smugfs/json.c b/src/cmd/smugfs/json.c index d6472b4d..c79c189c 100644 --- a/src/cmd/smugfs/json.c +++ b/src/cmd/smugfs/json.c @@ -22,7 +22,7 @@ static Json* newjval(int type) { Json *v; - + v = emalloc(sizeof *v); v->ref = 1; v->type = type; @@ -142,7 +142,7 @@ parsenumber(char **pp) double d; Json *v; - /* -?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?([Ee][-+]?[0-9]+) */ + /* -?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))?([Ee][-+]?[0-9]+) */ p = wskip(*pp); q = p; if(*q == '-') @@ -171,7 +171,7 @@ parsenumber(char **pp) while('0' <= *q && *q <= '9') q++; } - + t = emalloc(q-p+1); memmove(t, p, q-p); t[q-p] = 0; @@ -185,7 +185,7 @@ parsenumber(char **pp) v = newjval(Jnumber); v->number = d; *pp = q; - return v; + return v; } static Json* @@ -335,7 +335,7 @@ Json* parsejson(char *text) { Json *v; - + v = parsevalue(&text); if(v && text && *wskip(text) != 0){ jclose(v); @@ -417,7 +417,7 @@ printjval(Json *v) { Fmt fmt; char buf[256]; - + fmtfdinit(&fmt, 1, buf, sizeof buf); _printjval(&fmt, v, 0); fmtprint(&fmt, "\n"); @@ -429,7 +429,7 @@ int jsonfmt(Fmt *fmt) { Json *v; - + v = va_arg(fmt->args, Json*); if(fmt->flags&FmtSharp) _printjval(fmt, v, 0); @@ -484,7 +484,7 @@ Json* jlookup(Json *v, char *name) { int i; - + if(v->type != Jobject) return nil; for(i=0; i<v->len; i++) @@ -498,7 +498,7 @@ jwalk(Json *v, char *path) { char elem[128], *p, *next; int n; - + for(p=path; *p && v; p=next){ next = strchr(p, '/'); if(next == nil) @@ -547,7 +547,7 @@ int jstrcmp(Json *jv, char *s) { char *t; - + t = jstring(jv); if(t == nil) return -2; diff --git a/src/cmd/smugfs/jsonrpc.c b/src/cmd/smugfs/jsonrpc.c index 92490e77..f0043bb3 100644 --- a/src/cmd/smugfs/jsonrpc.c +++ b/src/cmd/smugfs/jsonrpc.c @@ -17,7 +17,7 @@ static void jfree(CEntry *ce) { JEntry *j; - + j = (JEntry*)ce; jclose(j->reply); } @@ -45,7 +45,7 @@ static char* makehttprequest(char *host, char *path, char *postdata) { Fmt fmt; - + fmtstrinit(&fmt); fmtprint(&fmt, "POST %s HTTP/1.0\r\n", path); fmtprint(&fmt, "Host: %s\r\n", host); @@ -87,7 +87,7 @@ dojsonhttp(Protocol *proto, char *host, char *request, int rfd, vlong rlength) { char *data; HTTPHeader hdr; - + data = httpreq(proto, host, request, &hdr, rfd, rlength); if(data == nil){ fprint(2, "httpreq: %r\n"); @@ -184,7 +184,7 @@ ncsmug(char *method, char *name1, ...) { Json *jv; va_list arg; - + va_start(arg, name1); // TODO: Could use https only for login. jv = jsonrpc(&https, HOST, PATH, method, name1, arg, 0); @@ -198,7 +198,7 @@ smug(char *method, char *name1, ...) { Json *jv; va_list arg; - + va_start(arg, name1); jv = jsonrpc(&http, HOST, PATH, method, name1, arg, 1); va_end(arg); @@ -241,4 +241,3 @@ jsonupload(Protocol *proto, char *host, char *req, int rfd, vlong rlength) jclose(jv); return nil; } - diff --git a/src/cmd/smugfs/log.c b/src/cmd/smugfs/log.c index 5603211e..5e2f015a 100644 --- a/src/cmd/smugfs/log.c +++ b/src/cmd/smugfs/log.c @@ -117,4 +117,3 @@ rpclog(char *fmt, ...) lbvappend(&rpclogbuf, fmt, arg); va_end(arg); } - diff --git a/src/cmd/smugfs/main.c b/src/cmd/smugfs/main.c index 6be0ca42..e1c2745f 100644 --- a/src/cmd/smugfs/main.c +++ b/src/cmd/smugfs/main.c @@ -32,7 +32,7 @@ smuglogin(void) nil); if(v == nil) sysfatal("login failed: %r"); - + memset(up->user, 'X', strlen(up->user)); memset(up->passwd, 'X', strlen(up->passwd)); free(up); @@ -80,13 +80,13 @@ threadmain(int argc, char **argv) default: usage(); }ARGEND - + if(argc != 0) usage(); if(name == nil && mtpt == nil) mtpt = "/n/smug"; - + /* * Check twice -- if there is an exited smugfs instance * mounted there, the first access will fail but unmount it. diff --git a/src/cmd/smugfs/openssl.c b/src/cmd/smugfs/openssl.c index baccd3ac..01b169c8 100644 --- a/src/cmd/smugfs/openssl.c +++ b/src/cmd/smugfs/openssl.c @@ -39,10 +39,10 @@ opensslconnect(char *host) sbio = BIO_new_ssl_connect(ctx); BIO_get_ssl(sbio, &ssl); SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); - + snprint(buf, sizeof buf, "%s:https", host); BIO_set_conn_hostname(sbio, buf); - + if(BIO_do_connect(sbio) <= 0 || BIO_do_handshake(sbio) <= 0){ ERR_error_string_n(ERR_get_error(), buf, sizeof buf); BIO_free_all(sbio); @@ -69,7 +69,7 @@ opensslwrite(Pfd *pfd, void *v, int n) { int m, total; char *p; - + p = v; total = 0; while(total < n){ @@ -80,7 +80,7 @@ opensslwrite(Pfd *pfd, void *v, int n) } total += m; } - return total; + return total; } static int diff --git a/src/cmd/smugfs/tcp.c b/src/cmd/smugfs/tcp.c index a203ece9..b8b95112 100644 --- a/src/cmd/smugfs/tcp.c +++ b/src/cmd/smugfs/tcp.c @@ -47,4 +47,3 @@ Protocol http = { httpwrite, httpclose, }; - diff --git a/src/cmd/smugfs/util.c b/src/cmd/smugfs/util.c index b4a649d8..90a12cb9 100644 --- a/src/cmd/smugfs/util.c +++ b/src/cmd/smugfs/util.c @@ -4,7 +4,7 @@ void* emalloc(int n) { void *v; - + v = mallocz(n, 1); if(v == nil) sysfatal("out of memory"); @@ -34,9 +34,9 @@ timefmt(Fmt *f) { Tm tm; vlong ms; - + ms = nsec()/1000000; - + tm = *localtime(ms/1000); fmtprint(f, "%02d:%02d:%02d.%03d", tm.hour, tm.min, tm.sec, @@ -64,7 +64,7 @@ urlencodefmt(Fmt *fmt) { int x; char *s; - + s = va_arg(fmt->args, char*); for(; *s; s++){ x = (uchar)*s; @@ -78,4 +78,3 @@ urlencodefmt(Fmt *fmt) } return 0; } - |