X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Fstructures%2Fstatic_memory_gremlin.cpp;h=20c081799ac04c73dd4c82df3020e7ee55e70a61;hb=6f6781c879a853e5435e20e897ae4e60b4a01fc7;hp=b84bbb69a8cfae47dbb8aa00e6d2b0e33cb20235;hpb=3ea085ec301ed1399dfa1e9f3a240312dc95410b;p=feisty_meow.git diff --git a/nucleus/library/structures/static_memory_gremlin.cpp b/nucleus/library/structures/static_memory_gremlin.cpp index b84bbb69..20c08179 100644 --- a/nucleus/library/structures/static_memory_gremlin.cpp +++ b/nucleus/library/structures/static_memory_gremlin.cpp @@ -1,16 +1,14 @@ -/*****************************************************************************\ -* * -* Name : static_memory_gremlin * -* Author : Chris Koeritz * -* * -******************************************************************************* -* Copyright (c) 2004-$now By Author. This program is free software; you can * -* redistribute it and/or modify it under the terms of the GNU General Public * -* License as published by the Free Software Foundation; either version 2 of * -* the License or (at your option) any later version. This is online at: * -* http://www.fsf.org/copyleft/gpl.html * -* Please send any updates to: fred@gruntose.com * -\*****************************************************************************/ +/* +* Name : static_memory_gremlin +* Author : Chris Koeritz +* +* Copyright (c) 2004-$now By Author. This program is free software; you can +* redistribute it and/or modify it under the terms of the GNU General Public +* License as published by the Free Software Foundation; either version 2 of +* the License or (at your option) any later version. This is online at: +* http://www.fsf.org/copyleft/gpl.html +* Please send any updates to: fred@gruntose.com +*/ #include "static_memory_gremlin.h" @@ -61,7 +59,7 @@ static_memory_gremlin::static_memory_gremlin() : c_lock(), c_top_index(0), c_actual_size(0), - c_pointers(NIL), + c_pointers(NULL_POINTER), c_show_debugging(false) { ensure_space_exists(); @@ -84,7 +82,7 @@ static_memory_gremlin::~static_memory_gremlin() // could be added on the end of the list as a result of this destruction. int zapped_index = c_top_index - 1; gremlin_object_record *ptr = c_pointers[zapped_index]; - c_pointers[zapped_index] = NIL; + c_pointers[zapped_index] = NULL_POINTER; // since we know the one we're zapping, we no longer need that index. c_top_index--; // this should allow us to keep chewing on items that are newly being @@ -103,7 +101,7 @@ static_memory_gremlin::~static_memory_gremlin() } #endif delete [] c_pointers; - c_pointers = NIL; + c_pointers = NULL_POINTER; } bool static_memory_gremlin::__program_is_dying() { return __global_program_is_dying; } @@ -127,7 +125,7 @@ root_object *static_memory_gremlin::get(const char *unique_name) { auto_synchronizer l(c_lock); int indy = locate(unique_name); - if (negative(indy)) return NIL; + if (negative(indy)) return NULL_POINTER; return c_pointers[indy]->c_object; } @@ -138,7 +136,7 @@ const char *static_memory_gremlin::find(const root_object *ptr) if (ptr == c_pointers[i]->c_object) return c_pointers[i]->c_name; } - return NIL; + return NULL_POINTER; } bool static_memory_gremlin::put(const char *unique_name, root_object *to_put) @@ -189,7 +187,7 @@ void static_memory_gremlin::ensure_space_exists() if (!new_ptr) { throw "error: static_memory_gremlin::ensure_space_exists: failed to allocate memory for pointer list"; } - for (int i = 0; i < c_actual_size; i++) new_ptr[i] = NIL; + for (int i = 0; i < c_actual_size; i++) new_ptr[i] = NULL_POINTER; for (int j = 0; j < c_actual_size - SMG_CHUNKING_FACTOR; j++) new_ptr[j] = c_pointers[j]; if (c_pointers) delete [] c_pointers; @@ -206,7 +204,7 @@ void static_memory_gremlin::ensure_space_exists() static_memory_gremlin &static_memory_gremlin::__hoople_globals() { static bool _initted = false; // tells whether we've gone through yet. - static static_memory_gremlin *_internal_gremlin = NIL; + static static_memory_gremlin *_internal_gremlin = NULL_POINTER; // holds our list of shared pieces... if (!_initted) {