From 329e943e4e73a546ba24a8459cce151bc867594c Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 12 Jul 2002 18:23:30 +0000 Subject: [PATCH] Use result buf for event and scope names. --- vvp/vpi_event.cc | 17 +++++++++++++++-- vvp/vpi_scope.cc | 18 ++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/vvp/vpi_event.cc b/vvp/vpi_event.cc index 2e5a4aac0..471b603bd 100644 --- a/vvp/vpi_event.cc +++ b/vvp/vpi_event.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_event.cc,v 1.3 2002/07/05 17:14:15 steve Exp $" +#ident "$Id: vpi_event.cc,v 1.4 2002/07/12 18:23:30 steve Exp $" #endif # include "vpi_priv.h" @@ -36,10 +36,20 @@ static char* named_event_str(int code, vpiHandle ref) struct __vpiNamedEvent*obj = (struct __vpiNamedEvent*)ref; + char *bn = vpi_get_str(vpiFullName, &obj->scope->base); + const char *nm = obj->name; + + char *rbuf = need_result_buf(strlen(bn) + strlen(nm) + 1, RBUF_STR); + switch (code) { + case vpiFullName: + sprintf(rbuf, "%s.%s", bn, nm); + return rbuf; + case vpiName: - return const_cast(obj->name); + strcpy(rbuf, nm); + return rbuf; } @@ -114,6 +124,9 @@ void vpip_run_named_event_callbacks(vpiHandle ref) /* * $Log: vpi_event.cc,v $ + * Revision 1.4 2002/07/12 18:23:30 steve + * Use result buf for event and scope names. + * * Revision 1.3 2002/07/05 17:14:15 steve * Names of vpi objects allocated as vpip_strings. * diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index 457fa751d..90c9bf3e4 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_scope.cc,v 1.16 2002/07/05 17:14:15 steve Exp $" +#ident "$Id: vpi_scope.cc,v 1.17 2002/07/12 18:23:30 steve Exp $" #endif # include "compile.h" @@ -28,6 +28,7 @@ #ifdef HAVE_MALLOC_H # include #endif +# include # include # include @@ -45,8 +46,8 @@ vpiHandle vpip_make_root_iterator(void) static char* scope_get_str(int code, vpiHandle obj) { struct __vpiScope*ref = (struct __vpiScope*)obj; - - char *n, *nn; + const char *n, *nn, *name = ref->name; + char *rbuf = need_result_buf(strlen(name) + 1, RBUF_STR); assert((obj->vpi_type->type_code == vpiModule) || (obj->vpi_type->type_code == vpiFunction) @@ -56,10 +57,11 @@ static char* scope_get_str(int code, vpiHandle obj) switch (code) { case vpiFullName: - return const_cast(ref->name); + strcpy(rbuf, name); + return rbuf; case vpiName: - nn = n = const_cast(ref->name); + nn = n = name; while (*n) if (*n=='\\' && *++n) ++n; @@ -67,7 +69,8 @@ static char* scope_get_str(int code, vpiHandle obj) nn = ++n; else ++n; - return nn; + strcpy(rbuf, nn); + return rbuf; default: assert(0); @@ -389,6 +392,9 @@ void vpip_attach_to_current_scope(vpiHandle obj) /* * $Log: vpi_scope.cc,v $ + * Revision 1.17 2002/07/12 18:23:30 steve + * Use result buf for event and scope names. + * * Revision 1.16 2002/07/05 17:14:15 steve * Names of vpi objects allocated as vpip_strings. *