Skip to content

Commit

Permalink
Fix wrecked rbuf in vpi_get_str of signals and memories.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Sep 11, 2002
1 parent 33f462f commit 0277035
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions vvp/vpi_memory.cc
Expand Up @@ -27,7 +27,7 @@
* Picture Elements, Inc., 777 Panoramic Way, Berkeley, CA 94704.
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_memory.cc,v 1.18 2002/08/12 01:35:09 steve Exp $"
#ident "$Id: vpi_memory.cc,v 1.19 2002/09/11 16:06:57 steve Exp $"
#endif

# include "vpi_priv.h"
Expand Down Expand Up @@ -109,20 +109,23 @@ static char* memory_get_str(int code, vpiHandle ref)

struct __vpiMemory*rfp = (struct __vpiMemory*)ref;

char *bn = vpi_get_str(vpiFullName, &rfp->scope->base);
char *bn = strdup(vpi_get_str(vpiFullName, &rfp->scope->base));
char *nm = memory_name(rfp->mem);

char *rbuf = need_result_buf(strlen(bn) + strlen(nm) + 1, RBUF_STR);
char *rbuf = need_result_buf(strlen(bn) + strlen(nm) + 2, RBUF_STR);

switch (code) {
case vpiFullName:
sprintf(rbuf, "%s.%s", bn, nm);
free(bn);
return rbuf;
case vpiName:
strcpy(rbuf, nm);
free(bn);
return rbuf;
}

free(bn);
return 0;
}

Expand Down Expand Up @@ -580,6 +583,9 @@ vpiHandle vpip_make_memory(vvp_memory_t mem)

/*
* $Log: vpi_memory.cc,v $
* Revision 1.19 2002/09/11 16:06:57 steve
* Fix wrecked rbuf in vpi_get_str of signals and memories.
*
* Revision 1.18 2002/08/12 01:35:09 steve
* conditional ident string using autoconfig.
*
Expand Down
12 changes: 9 additions & 3 deletions vvp/vpi_signal.cc
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_signal.cc,v 1.48 2002/09/10 02:27:11 steve Exp $"
#ident "$Id: vpi_signal.cc,v 1.49 2002/09/11 16:06:57 steve Exp $"
#endif

/*
Expand Down Expand Up @@ -110,22 +110,25 @@ static char* signal_get_str(int code, vpiHandle ref)

struct __vpiSignal*rfp = (struct __vpiSignal*)ref;

char *bn = vpi_get_str(vpiFullName, &rfp->scope->base);
char *bn = strdup(vpi_get_str(vpiFullName, &rfp->scope->base));
char *nm = (char*)rfp->name;

char *rbuf = need_result_buf(strlen(bn) + strlen(nm) + 1, RBUF_STR);
char *rbuf = need_result_buf(strlen(bn) + strlen(nm) + 2, RBUF_STR);

switch (code) {

case vpiFullName:
sprintf(rbuf, "%s.%s", bn, nm);
free(bn);
return rbuf;

case vpiName:
strcpy(rbuf, nm);
free(bn);
return rbuf;
}

free(bn);
return 0;
}

Expand Down Expand Up @@ -719,6 +722,9 @@ vpiHandle vpip_make_net(const char*name, int msb, int lsb,

/*
* $Log: vpi_signal.cc,v $
* Revision 1.49 2002/09/11 16:06:57 steve
* Fix wrecked rbuf in vpi_get_str of signals and memories.
*
* Revision 1.48 2002/09/10 02:27:11 steve
* Actually set strength pointer when getting strength val.
*
Expand Down

0 comments on commit 0277035

Please sign in to comment.