e71a0ffa079c886110e57e05ef15a7200a0409bc
Stefan Schuermans cleanup file headers after...

Stefan Schuermans authored 13 years ago

BlinkenLib/Tools.c  1) /* BlinkenLib
Stefan Schuermans move msleep and get_ms to t...

Stefan Schuermans authored 1 year ago

src/Tools.c         2)    Copyright 2004-2023 Stefan Schuermans <stefan@schuermans.info>
Stefan Schuermans cleanup file headers after...

Stefan Schuermans authored 13 years ago

BlinkenLib/Tools.c  3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
BlinkenLib/Tools.c  4)    a blinkenarea.org project */
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c             5) 
Stefan Schuermans move msleep and get_ms to t...

Stefan Schuermans authored 1 year ago

src/Tools.c         6) #include "Tools.h"
src/Tools.c         7) 
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c             8) #include <stdlib.h>
Tools.c             9) 
Stefan Schuermans move msleep and get_ms to t...

Stefan Schuermans authored 1 year ago

src/Tools.c        10) #ifdef WIN32
src/Tools.c        11) #include <windows.h>
src/Tools.c        12) #include <winsock2.h>
src/Tools.c        13) #else
src/Tools.c        14) #include <sys/time.h>
src/Tools.c        15) #include <unistd.h>
src/Tools.c        16) #endif
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c            17) 
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/Tools.c        18) void *BlinkenMalloc1D(int count1, int size) {
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/Tools.c 19)   if (count1 < 1)
BlinkenLib/Tools.c 20)     count1 = 1;
BlinkenLib/Tools.c 21)   if (size < 1)
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c            22)     return NULL;
Tools.c            23) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/Tools.c 24)   return malloc(count1 * size);
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c            25) }
Tools.c            26) 
Stefan Schuermans format

Stefan Schuermans authored 1 year ago

src/Tools.c        27) void **BlinkenMalloc2D(int count1, int count2, int size) {
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c            28)   int sz, i;
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/Tools.c 29)   char *p;
BlinkenLib/Tools.c 30)   void **ptr;
BlinkenLib/Tools.c 31) 
BlinkenLib/Tools.c 32)   if (count1 < 1)
BlinkenLib/Tools.c 33)     count1 = 1;
BlinkenLib/Tools.c 34)   if (count2 < 1)
BlinkenLib/Tools.c 35)     count2 = 1;
BlinkenLib/Tools.c 36)   if (size < 1)
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c            37)     return NULL;
Tools.c            38) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/Tools.c 39)   sz = count1 * sizeof(void *) + count1 * count2 * size;
BlinkenLib/Tools.c 40)   p = (char *)malloc(sz);
BlinkenLib/Tools.c 41)   if (p == NULL)
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c            42)     return NULL;
Tools.c            43) 
Stefan Schuermans changed indenting to be mor...

Stefan Schuermans authored 13 years ago

BlinkenLib/Tools.c 44)   ptr = (void **)p;
BlinkenLib/Tools.c 45)   p += count1 * sizeof(void *);
BlinkenLib/Tools.c 46)   for (i = 0; i < count1; i++) {
Christian Heimke BlinkenLib v.0.1.1 (2005-01...

Christian Heimke authored 13 years ago

Tools.c            47)     ptr[i] = (void *)p;
Tools.c            48)     p += count2 * size;
Tools.c            49)   }
Tools.c            50)   return ptr;
Tools.c            51) }