History fileview: select current item on rightclick
[GitX.git] / speed_test / malloc.c
blob5fbadcae7194741a17af66fff6c10ec4cf7a0c2d
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <xlocale.h>
4 #include <stdarg.h>
5 #include <unistd.h>
6 #include <string.h>
8 struct list {
9 struct hash* columns;
10 int numColumns;
12 struct hash {
13 char value[40];
16 int main() {
17 srandomdev();
19 int i = 0; struct list* last;
20 int num = atoi("8000000");
22 int size = 1000;
23 /* Initialize initial list of revisions */
24 struct list** revisionList = malloc(size * sizeof(struct list*));
26 struct hash standardColumn;
27 strcpy(standardColumn.value, "Haha pieter");
28 for (i = 0; i < num; i++) {
29 if (size <= i) {
30 size *= 2;
31 revisionList = realloc(revisionList, size * sizeof(struct list*));
34 struct list* a = malloc(sizeof(struct list));
35 revisionList[i] = a;
37 a->numColumns = i % 5;
38 a->columns = malloc(a->numColumns * sizeof(struct hash));
39 int j;
40 for (j = 0; j < a->numColumns; j++) {
41 //ccolumns[currentColumn++] = st
42 strncpy(a->columns[j].value, "Haha pieter is cool", 20);
46 printf("Num value at 3000 is: %i vs %i\n", revisionList[3000]->numColumns, (int) (5 * random()));
47 return 0;