Function dict_open exists if page size or magic aren't right.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: delete.c,v $
- * Revision 1.2 1995-12-06 17:48:30 adam
+ * Revision 1.3 1995-12-07 11:48:55 adam
+ * Insert operation obeys DICT_type = 1 (slack in page).
+ * Function dict_open exists if page size or magic aren't right.
+ *
+ * Revision 1.2 1995/12/06 17:48:30 adam
* Bug fix: delete didn't work.
*
* Revision 1.1 1995/12/06 14:52:21 adam
indxp[-mid] = indxp[-mid-1];
mid++;
}
+ DICT_type(p) = 1;
(DICT_nodir(p))--;
dict_bf_touch (dict->dbf, ptr);
return 1;
if (info[sizeof(Dict_ptr)+sizeof(Dict_char)])
{
info[sizeof(Dict_ptr)+sizeof(Dict_char)] = 0;
+ DICT_type(p) = 1;
dict_bf_touch (dict->dbf, ptr);
return 1;
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: insert.c,v $
- * Revision 1.13 1995-11-28 09:06:37 adam
+ * Revision 1.14 1995-12-07 11:48:56 adam
+ * Insert operation obeys DICT_type = 1 (slack in page).
+ * Function dict_open exists if page size or magic aren't right.
+ *
+ * Revision 1.13 1995/11/28 09:06:37 adam
* Fixed potential dangling pointer.
*
* Revision 1.12 1995/09/06 10:34:44 adam
if (DICT_size(p)+slen+userlen >=
DICT_pagesize(dict) - (1+DICT_nodir(p))*sizeof(short)) /* overflow? */
{
+ if (DICT_type(p))
+ {
+ clean_page (dict, ptr, p, NULL, 0, NULL);
+ return dict_ins (dict, str, ptr, userlen, userinfo);
+ }
split_page (dict, ptr, p);
return dict_ins (dict, str, ptr, userlen, userinfo);
}
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: open.c,v $
- * Revision 1.7 1995-09-04 12:33:32 adam
+ * Revision 1.8 1995-12-07 11:48:56 adam
+ * Insert operation obeys DICT_type = 1 (slack in page).
+ * Function dict_open exists if page size or magic aren't right.
+ *
+ * Revision 1.7 1995/09/04 12:33:32 adam
* Various cleanup. YAZ util used instead.
*
* Revision 1.6 1994/10/05 12:16:52 adam
page_size = atoi (res_get_def (common_resource, resource_str,
DICT_DEFAULT_PAGESIZE));
- if (page_size < 1024)
+ if (page_size < 2048)
{
- logf (LOG_WARN, "Resource %s was too small. Set to 1024",
+ logf (LOG_WARN, "Resource %s was too small. Set to 2048",
resource_str);
- page_size = 1024;
+ page_size = 2048;
}
dict->dbf = dict_bf_open (name, page_size, cache, rw);
dict->rw = rw;
if (strcmp (dh->magic_str, DICT_MAGIC))
{
logf (LOG_WARN, "Bad magic of `%s'", name);
- dict_bf_close (dict->dbf);
- xfree (dict);
- return NULL;
+ exit (1);
}
if (dh->page_size != page_size)
{
logf (LOG_WARN, "Resource %s is %d and pagesize of `%s' is %d",
resource_str, page_size, name, dh->page_size);
- dict_bf_close (dict->dbf);
- xfree (dict);
- return NULL;
+ exit (1);
}
memcpy (&dict->head, dh, sizeof(*dh));
}