X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Foid.c;fp=src%2Foid.c;h=8ae75083ca59bd99a83b03db733a4f2b45644411;hb=e497fb7edee04454e0f08fd1ed975fa6966341ac;hp=ac33b0e58348d03446e5260d942aee05d91b7cc5;hpb=2db81a6ebbae290b043cbe6b911972de3a00cb19;p=yaz-moved-to-github.git diff --git a/src/oid.c b/src/oid.c index ac33b0e..8ae7508 100644 --- a/src/oid.c +++ b/src/oid.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: oid.c,v 1.7 2005-01-15 19:47:14 adam Exp $ + * $Id: oid.c,v 1.8 2005-05-26 21:46:41 adam Exp $ */ /** @@ -493,7 +493,6 @@ struct oident *oid_addent (int *oid, enum oid_proto proto, nmem_mutex_enter (oid_mutex); if (!oident) { - char desc_str[200]; struct oident_list *oident_list; oident_list = (struct oident_list *) nmem_malloc (oid_nmem, sizeof(*oident_list)); @@ -503,14 +502,20 @@ struct oident *oid_addent (int *oid, enum oid_proto proto, if (!desc) { + char desc_str[OID_SIZE*10]; int i; - sprintf (desc_str, "%d", *oid); - for (i = 1; i < 12 && oid[i] >= 0; i++) - sprintf (desc_str+strlen(desc_str), ".%d", oid[i]); - desc = desc_str; + *desc_str = '\0'; + if (*oid >= 0) + { + sprintf (desc_str, "%d", *oid); + for (i = 1; i < OID_SIZE && oid[i] >= 0; i++) + sprintf (desc_str+strlen(desc_str), ".%d", oid[i]); + } + oident->desc = nmem_strdup(oid_nmem, desc_str); } - oident->desc = nmem_strdup (oid_nmem, desc); + else + oident->desc = nmem_strdup(oid_nmem, desc); if (value == VAL_DYNAMIC) oident->value = (enum oid_value) (++oid_value_dynamic); else