tcmd/venti/srv: split memory allocation call - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 386bd9cae471438a685234556111a01a666ca165
 (DIR) parent 0b6b451b71bc116c8b98cdbbfbec3fbca6c8fc17
 (HTM) Author: Neven Sajko <nsajko@gmail.com>
       Date:   Tue,  7 Jan 2020 17:17:39 +0000
       
       cmd/venti/srv: split memory allocation call
       
       This splits a certain vtmallocz call in mkihash into two vtmallocz
       calls. The first issue this fixes is that the C aliasing rules were not
       respected in the code before this commit. The other thing is that this
       enables better memory alignment guarantees.
       
       Updates #313
       
       Change-Id: Ia4f3e0fc85facc778193f5e977d4f99a1a9abd23
       
       Diffstat:
         M src/cmd/venti/srv/icache.c          |       4 ++--
       
       1 file changed, 2 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/venti/srv/icache.c b/src/cmd/venti/srv/icache.c
       t@@ -68,8 +68,8 @@ mkihash(int size1)
                        size <<= 1;
                }
        
       -        ih = vtmallocz(sizeof(IHash)+size*sizeof(ih->table[0]));
       -        ih->table = (IEntry**)(ih+1);
       +        ih = vtmallocz(sizeof(IHash));
       +        ih->table = vtmallocz(size * sizeof(ih->table[0]));
                ih->bits = bits;
                ih->size = size;
                return ih;