};
struct yaz_oid_db standard_db_l = {
- yaz_oid_standard_entries, 0, 0
+ 0, 0, 0
};
yaz_oid_db_t standard_db = &standard_db_l;
return standard_db;
}
+#define get_entries(db) (db->xmalloced==0 ? yaz_oid_standard_entries : db->entries)
+
const Odr_oid *yaz_string_to_oid(yaz_oid_db_t oid_db,
oid_class oclass, const char *name)
{
struct yaz_oid_entry *e;
if (oclass != CLASS_GENERAL)
{
- for (e = oid_db->entries; e->name; e++)
+ for (e = get_entries(oid_db); e->name; e++)
{
if (!yaz_matchstr(e->name, name) && oclass == e->oclass)
return e->oid;
}
}
- for (e = oid_db->entries; e->name; e++)
+ for (e = get_entries(oid_db); e->name; e++)
{
if (!yaz_matchstr(e->name, name))
return e->oid;
return 0;
for (; oid_db; oid_db = oid_db->next)
{
- struct yaz_oid_entry *e = oid_db->entries;
+ struct yaz_oid_entry *e = get_entries(oid_db);
for (; e->name; e++)
{
if (!oid_oidcmp(e->oid, oid))
const char *yaz_oid_to_string_buf(const Odr_oid *oid, oid_class *oclass, char *buf)
{
- const char *p = yaz_oid_to_string(standard_db, oid, oclass);
+ const char *p = yaz_oid_to_string(yaz_oid_std(), oid, oclass);
if (p)
return p;
if (oclass)
{
for (; oid_db; oid_db = oid_db->next)
{
- struct yaz_oid_entry *e = oid_db->entries;
+ struct yaz_oid_entry *e = get_entries(oid_db);
for (; e->name; e++)
func(e->oid, e->oclass, e->name, client_data);
#endif
#if HAVE_SYS_TIME_H
struct timeval start_time, end_time;
-#endif
+#else
#ifdef WIN32
LONGLONG start_time, end_time;
LONGLONG start_time_sys, start_time_user;
LONGLONG end_time_sys, end_time_user;
#endif
+#endif
double real_sec, user_sec, sys_sec;
};
#if HAVE_SYS_TIME_H
gettimeofday(&t->start_time, 0);
t->real_sec = 0.0;
-#endif
+#else
#ifdef WIN32
t->real_sec = 0.0;
t->user_sec = 0.0;
get_date_as_largeinteger(&t->start_time);
get_process_time(&t->start_time_user, &t->start_time_sys);
#endif
+#endif
}
void yaz_timing_stop(yaz_timing_t t)
gettimeofday(&t->end_time, 0);
t->real_sec = ((t->end_time.tv_sec - t->start_time.tv_sec) * 1000000.0 +
t->end_time.tv_usec - t->start_time.tv_usec) / 1000000;
-
-#endif
+#else
#ifdef WIN32
get_date_as_largeinteger(&t->end_time);
t->real_sec = (t->end_time - t->start_time) / 10000000.0;
t->user_sec = (t->end_time_user - t->start_time_user) / 10000000.0;
t->sys_sec = (t->end_time_sys - t->start_time_sys) / 10000000.0;
#endif
+#endif
}
double yaz_timing_get_real(yaz_timing_t t)