X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fodr_util.c;h=6efa6c03fcdbd4ffdee376bca3c15daaa994c2b7;hp=20009c13c5563a41b1b0bb4111f46e56646a3635;hb=1f1e067ae72eff85b653b72f9450ee6b50dcc272;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0 diff --git a/src/odr_util.c b/src/odr_util.c index 20009c1..6efa6c0 100644 --- a/src/odr_util.c +++ b/src/odr_util.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ /** @@ -12,16 +12,18 @@ #include #include -#include #include "odr-priv.h" #include void odr_prname(ODR o, const char *name) { - if (name) - odr_printf(o, "%*s%s ", o->op->indent*4, "", name); + if (o->op->indent < 16) + odr_printf(o, "%*s", o->op->indent * 2, ""); else - odr_printf(o, "%*s", o->op->indent*4, ""); + odr_printf(o, "level=%-7d%*s", o->op->indent, + 2 * (o->op->indent % 8) , ""); + if (name) + odr_printf(o, "%s ", name); } int odp_more_chunks(ODR o, const unsigned char *base, int len) @@ -105,18 +107,18 @@ char *odr_prepend(ODR o, const char *prefix, const char *old) char *res = (char*) odr_malloc (o, olen + plen + 2); *res = '\0'; - if (prefix != 0) - strcpy (res, prefix); - if (prefix != 0 && old != 0) - strcat (res, "/"); - if (old !=0) - strcat (res, old); - + if (plen > 0) + strcpy(res, prefix); + if (plen > 0 && old != 0) + strcat(res, "/"); + if (old != 0) + strcat(res, old); return res; } /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab