X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fodr_util.c;h=6efa6c03fcdbd4ffdee376bca3c15daaa994c2b7;hb=883245e48ad6e5735ab73884e18dc6cb5c297c86;hp=b42ee79302f3eb466e5af72adb80f6e1a292a2ad;hpb=7a98e9bfbb9d5fe7d44822a9838e3becbdce9363;p=yaz-moved-to-github.git diff --git a/src/odr_util.c b/src/odr_util.c index b42ee79..6efa6c0 100644 --- a/src/odr_util.c +++ b/src/odr_util.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. - * - * $Id: odr_util.c,v 1.13 2007-05-08 08:22:36 adam Exp $ */ /** * \file odr_util.c @@ -14,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) @@ -107,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