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/libventi/packet.c | |
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/libventi/packet.c')
-rw-r--r-- | src/libventi/packet.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/libventi/packet.c b/src/libventi/packet.c index d19d8537..8d162818 100644 --- a/src/libventi/packet.c +++ b/src/libventi/packet.c @@ -35,7 +35,7 @@ enum { FragLocalAlloc, FragGlobal }; - + struct Frag { int state; @@ -55,10 +55,10 @@ struct Packet ulong pc; Packet *next; - + Frag *first; Frag *last; - + Frag local[NLocalFrag]; }; @@ -80,7 +80,7 @@ static void checkpacket(Packet*); #endif /* - * the free list is primarily for speed, but it is + * the free list is primarily for speed, but it is * also necessary for packetsplit that packets * are never freed -- a packet can contain a different * packet's local fragments, thanks to packetsplit! @@ -157,7 +157,7 @@ packetfree(Packet *p) Packet * packetdup(Packet *p, int offset, int n) -{ +{ Frag *f, *ff; Packet *pp; @@ -179,7 +179,7 @@ packetdup(Packet *p, int offset, int n) /* skip offset */ for(f=p->first; offset >= FRAGSIZE(f); f=f->next) offset -= FRAGSIZE(f); - + /* first frag */ ff = fragdup(pp, f); ff->rp += offset; @@ -195,7 +195,7 @@ packetdup(Packet *p, int offset, int n) n -= FRAGSIZE(ff); pp->asize += FRAGASIZE(ff); } - + /* fix up last frag: note n <= 0 */ ff->wp += n; ff->next = nil; @@ -295,7 +295,7 @@ packettrim(Packet *p, int offset, int n) NOTFREE(p); return 0; } - + /* free before offset */ for(f=p->first; offset >= FRAGSIZE(f); f=ff) { p->asize -= FRAGASIZE(f); @@ -341,7 +341,7 @@ packetheader(Packet *p, int n) } p->size += n; - + /* try and fix in current frag */ f = p->first; if(f != nil) { @@ -377,7 +377,7 @@ packettrailer(Packet *p, int n) } p->size += n; - + /* try and fix in current frag */ if(p->first != nil) { f = p->last; @@ -433,7 +433,7 @@ packetprefix(Packet *p, uchar *buf, int n) nn = n; if(nn > MaxFragSize) nn = MaxFragSize; - f = fragalloc(p, nn, PEnd, p->first); + f = fragalloc(p, nn, PEnd, p->first); p->asize += FRAGASIZE(f); if(p->first == nil) p->last = f; @@ -470,7 +470,7 @@ packetappend(Packet *p, uchar *buf, int n) n -= nn; } } - + while(n > 0) { nn = n; if(nn > MaxFragSize) @@ -537,7 +537,7 @@ packetpeek(Packet *p, uchar *buf, int offset, int n) werrstr(EPacketSize); return nil; } - + /* skip up to offset */ for(f=p->first; offset >= FRAGSIZE(f); f=f->next) offset -= FRAGSIZE(f); @@ -586,7 +586,7 @@ packetfragments(Packet *p, IOchunk *io, int nio, int offset) NOTFREE(p); if(p->size == 0 || nio <= 0) return 0; - + if(offset < 0 || offset > p->size) { werrstr(EPacketOffset); return -1; @@ -599,7 +599,7 @@ packetfragments(Packet *p, IOchunk *io, int nio, int offset) eio = io + nio; for(; f != nil && io < eio; f=f->next) { io->addr = f->rp + offset; - io->len = f->wp - (f->rp + offset); + io->len = f->wp - (f->rp + offset); offset = 0; size += io->len; io++; @@ -633,7 +633,7 @@ packetstats(void) nbm = 0; for(m=freelist.bigmem; m; m=m->next) nbm++; - + fprint(2, "packet: %d/%d frag: %d/%d small mem: %d/%d big mem: %d/%d\n", np, freelist.npacket, nf, freelist.nfrag, @@ -651,7 +651,7 @@ packetsize(Packet *p) if(1) { Frag *f; int size = 0; - + for(f=p->first; f; f=f->next) size += FRAGSIZE(f); if(size != p->size) @@ -668,7 +668,7 @@ packetasize(Packet *p) if(0) { Frag *f; int asize = 0; - + for(f=p->first; f; f=f->next) asize += FRAGASIZE(f); if(asize != p->asize) @@ -764,7 +764,7 @@ fragalloc(Packet *p, int n, int pos, Frag *next) goto Found; } } - lock(&freelist.lk); + lock(&freelist.lk); f = freelist.frag; if(f != nil) freelist.frag = f->next; @@ -825,7 +825,7 @@ fragdup(Packet *p, Frag *f) Frag *ff; Mem *m; - m = f->mem; + m = f->mem; /* * m->rp && m->wp can be out of date when ref == 1 @@ -853,7 +853,7 @@ fragdup(Packet *p, Frag *f) unlock(&m->lk); } - + return ff; } @@ -877,7 +877,7 @@ fragfree(Frag *f) lock(&freelist.lk); f->next = freelist.frag; freelist.frag = f; - unlock(&freelist.lk); + unlock(&freelist.lk); } static Mem * @@ -915,7 +915,7 @@ memalloc(int n, int pos) m->bp = vtbrk(nn); m->ep = m->bp + nn; } - assert(m->ref == 0); + assert(m->ref == 0); m->ref = 1; switch(pos) { @@ -930,7 +930,7 @@ memalloc(int n, int pos) break; case PEnd: m->rp = m->ep - n; - break; + break; } /* check we did not blow it */ if(m->rp < m->bp) |