diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/utils.c | 5 | ||||
-rw-r--r-- | src/common/utils.h | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/common/utils.c b/src/common/utils.c index 30649e2f5..9e3dbac47 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -309,7 +309,7 @@ bool HCache_check(const char *file) { return false; } - if( fread(dT,sizeof(dT),1,second) != 1 || fread(&rtime,sizeof(rtime),1,second) != 1 || dT[0] != 'k' || HCache->recompile_time > rtime ) { + if( fread(dT,sizeof(dT),1,second) != 1 || fread(&rtime,sizeof(rtime),1,second) != 1 || dT[0] != HCACHE_KEY || HCache->recompile_time > rtime ) { fclose(first); fclose(second); return false; @@ -343,7 +343,8 @@ FILE *HCache_open(const char *file, const char *opt) { } if( opt[0] != 'r' ) { - char dT[1] = "k";/* 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */ + char dT[1];/* 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */ + dT[0] = HCACHE_KEY; hwrite(dT,sizeof(dT),1,first); hwrite(&HCache->recompile_time,sizeof(HCache->recompile_time),1,first); } diff --git a/src/common/utils.h b/src/common/utils.h index b1fb4e3a0..32087d78f 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -9,6 +9,9 @@ #include <stdio.h> // FILE* #include <time.h> +/* [HCache] 1-byte key to ensure our method is the latest, we can modify to ensure the method matches */ +#define HCACHE_KEY 'k' + // generate a hex dump of the first 'length' bytes of 'buffer' void WriteDump(FILE* fp, const void* buffer, size_t length); void ShowDump(const void* buffer, size_t length); |