2 Commity 39b3db3344 ... 52729cbc70

Autor SHA1 Správa Dátum
  izzy 52729cbc70 fix realloc bug in vec 6 mesiacov pred
  David Ulrich 197298b3be bugfix epoch ts helper 6 mesiacov pred
2 zmenil súbory, kde vykonal 3 pridanie a 5 odobranie
  1. 1 3
      misc.c
  2. 2 2
      vec.c

+ 1 - 3
misc.c

@@ -36,15 +36,13 @@ double timeSincePerf(double past) {
 double getCurrentTimeEpoch(void) { // in seconds
 	double now;
 	struct timespec ts;
-	static double offset = 0;
 	
 	// CLOCK_MONOTONIC_RAW in >= Linux 2.6.28.
 	clock_gettime(CLOCK_REALTIME, &ts);
 	
 	now = (double)ts.tv_sec + ((double)ts.tv_nsec / 1000000000.0);
-	if(offset == 0) offset = now;
 	
-	return now - offset;
+	return now;
 }
 // deceptively but consistently named, this function is comparative with stamps
 //   provided by the previous function

+ 2 - 2
vec.c

@@ -49,9 +49,9 @@ void vec_c_resize_to(void** data, size_t* size, size_t elem_size, size_t new_siz
 	
 	size_t npot = nextPOT(new_size);
 	
-	tmp = realloc(*data, *size * elem_size);
+	tmp = realloc(*data, npot * elem_size);
 	if(!tmp) {
-		fprintf(stderr, "Out of memory in vector resize, %ld bytes requested\n", *size);
+		fprintf(stderr, "Out of memory in vector resize, %ld bytes requested\n", npot);
 		return;
 	}