Fixed a hash collision causing null variables to be overwritten
Andrew, don't you dare run my code through a clanker again or I'll hunt your Canuck ass down and beat you with a hockey stick.
This commit is contained in:
@@ -13,7 +13,7 @@ int inspect_bucket(Toy_Bucket** bucketHandle) {
|
||||
unsigned char* ptr = iter->data;
|
||||
|
||||
|
||||
while ((ptr - iter->data < iter->count) && *((int*)ptr) != 0) { //for each partition
|
||||
while ((ptr >= iter->data) && (ptr < iter->data + iter->count) && *((int*)ptr) != 0) { //for each partition
|
||||
if ( ( *((int*)ptr) & 1) == 0) { //is this partition still in use?
|
||||
occupied++;
|
||||
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ unsigned char* readFile(char* path, int* size) {
|
||||
|
||||
//determine the file's length
|
||||
fseek(file, 0L, SEEK_END);
|
||||
*size = ftell(file);
|
||||
*size = (int)ftell(file);
|
||||
rewind(file);
|
||||
|
||||
//make some space
|
||||
@@ -44,7 +44,7 @@ unsigned char* readFile(char* path, int* size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buffer[(*size)++] = '\0';
|
||||
buffer[(*size)] = '\0';
|
||||
|
||||
//clean up and return
|
||||
fclose(file);
|
||||
@@ -334,7 +334,7 @@ int repl(const char* filepath, bool verbose) {
|
||||
inputBuffer[--length] = '\0';
|
||||
}
|
||||
|
||||
if (length == 0 || !inputBuffer[ strspn(inputBuffer, " \r\n\t") ]) {
|
||||
if (length == 0 || inputBuffer[ strspn(inputBuffer, " \r\n\t") ] == '\0') {
|
||||
printf("%s> ", prompt); //shows the terminal prompt and restart
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user