[hackers] [libixp] Properly calculate the size of IxpCFid allocations.

From: Kris Maglione <jg_AT_suckless.org>
Date: Fri Jun 01 20:59:02 2007

changeset: 61:0cd87c63d7f0
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri Jun 01 14:57:42 2007 -0400
summary: Properly calculate the size of IxpCFid allocations.

diff -r 2c1d8bcb12ac -r 0cd87c63d7f0 libixp/client.c
--- a/libixp/client.c Fri Jun 01 14:38:08 2007 -0400
+++ b/libixp/client.c Fri Jun 01 14:57:42 2007 -0400
@@ -27,20 +27,19 @@ min(int a, int b) {
 
 static IxpCFid *
 getfid(IxpClient *c) {
- IxpCFid *temp;
- uint i;
-
- temp = c->freefid;
- if(temp != nil)
- c->freefid = temp->next;
+ IxpCFid *f;
+
+ f = c->freefid;
+ if(f != nil)
+ c->freefid = f->next;
         else {
- temp = ixp_emallocz(sizeof(IxpCFid) * i);
- temp->client = c;
- temp->fid = ++c->lastfid;
- }
- temp->next = nil;
- temp->open = 0;
- return temp;
+ f = ixp_emallocz(sizeof *f);
+ f->client = c;
+ f->fid = ++c->lastfid;
+ }
+ f->next = nil;
+ f->open = 0;
+ return f;
 }
 
 static void
@@ -240,7 +239,7 @@ ixp_remove(IxpClient *c, char *path) {
         return ret;
 }
 
-void
+static void
 initfid(IxpCFid *f, Fcall *fcall) {
         f->open = 1;
         f->offset = 0;
Received on Fri Jun 01 2007 - 20:59:02 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:15 UTC