Author: leo
Date: Tue Oct 18 06:36:23 2005
New Revision: 9507
Modified:
trunk/dynclasses/gdbmhash.pmc
Log:
load libgdbm just once
Modified: trunk/dynclasses/gdbmhash.pmc
==============================================================================
--- trunk/dynclasses/gdbmhash.pmc (original)
+++ trunk/dynclasses/gdbmhash.pmc Tue Oct 18 06:36:23 2005
@@ -81,15 +81,17 @@ Class initialization. Allocates the memo
*/
void class_init() {
- /* XXX: Name of the lib should be configurable */
+ if (pass) {
+ /* XXX: Name of the lib should be configurable */
#ifdef WIN32
- STRING *slib = string_from_cstring(INTERP, "gdbm3", 0);
+ STRING *slib = string_from_cstring(INTERP, "gdbm3", 0);
#else
- STRING *slib = string_from_cstring(INTERP, "libgdbm", 0);
+ STRING *slib = string_from_cstring(INTERP, "libgdbm", 0);
#endif
- /* XXX: What if libgdbm.so cannot be loaded */
- Parrot_load_lib(INTERP, slib, NULL);
+ /* XXX: What if libgdbm.so cannot be loaded */
+ Parrot_load_lib(INTERP, slib, NULL);
+ }
}
void init () {
@@ -108,7 +110,7 @@ Class initialization. Allocates the memo
=item C<VOID set_string_native(STRING* value)>
-Open a or create a new dbm file.
+Open a or create a new dbm file.
=cut
@@ -147,7 +149,7 @@ XXX: This can be optimized by keeping tr
nextkey = gdbm_nextkey( dbf, key );
free( key.dptr );
}
-
+
return cnt;
}
}
@@ -230,7 +232,7 @@ Returns the string value for the element
val = string_from_cstring(INTERP, val_gdbm.dptr, val_gdbm.dsize);
free( val_gdbm.dptr );
-
+
return val;
}
@@ -329,7 +331,7 @@ Returns whether a key C<*key> exists in
key_gdbm.dsize = keystr->strlen;
key_gdbm.dptr = keystr->strstart;
-
+
return gdbm_exists(dbf, key_gdbm);
}
@@ -354,7 +356,7 @@ Deletes the element associated with C<*k
key_gdbm.dsize = keystr->strlen;
key_gdbm.dptr = keystr->strstart;
-
+
if ( gdbm_exists(dbf, key_gdbm) ) {
gdbm_delete(dbf, key_gdbm);
}