$Log$
+Revision 1.403 1999/10/29 01:48:45 ajc
+* database.c: Removed arbitrary limit on maximum number of sessions
+
Revision 1.402 1999/10/29 01:03:03 ajc
* Debugged all possible ways for a session to terminate; do them cleanly.
* Assign session numbers in a more portable and less arbitrary way.
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
-
GDBM_FILE gdbms[MAXCDB];
/*
- * We also keep these around, for sequential searches... (one per
- * session. Maybe there's a better way?) FIX ... there _is_ a better
- * way. We have TSD functions now; use them.
+ * We also keep these around, for sequential searches (one per session slot)
*/
-#define MAXKEYS 256
-datum dtkey[MAXKEYS];
+int max_keys = 0;
+datum *dtkey;
/*
* does not exist should be created.
*/
void open_databases(void) {
- int a;
-
lprintf(7, "%s\n", gdbm_version);
/*
exit(1);
}
- for (a=0; a<MAXKEYS; ++a) {
- dtkey[a].dsize = 0;
- dtkey[a].dptr = NULL;
- }
-
/*
end_critical_section(S_DATABASE);
*/
}
end_critical_section(S_DATABASE);
- for (a=0; a<MAXKEYS; ++a) {
+ for (a=0; a<max_keys; ++a) {
if (dtkey[a].dptr != NULL) {
phree(dtkey[a].dptr);
}
*/
void cdb_rewind(int cdb) {
+ while (max_keys <= CC->cs_pid) {
+ ++max_keys;
+ if (dtkey == NULL) {
+ dtkey = (datum *)
+ mallok( (sizeof(datum) * max_keys) );
+ }
+ else {
+ dtkey = (datum *)
+ reallok(dtkey, (sizeof(datum) * max_keys) );
+ }
+ dtkey[max_keys - 1].dsize = 0;
+ dtkey[max_keys - 1].dptr = NULL;
+ }
+
if (dtkey[CC->cs_pid].dptr != NULL) {
phree(dtkey[CC->cs_pid].dptr);
}