Update of /var/lib/cvs/src/d2c/runtime/c-code
In directory cantor:/tmp/cvs-serv13902/c-code
Modified Files:
main.c
Log Message:
Use strncpy rather than strcpy. Also, use result of strlen instead
of multiple calls to strlen.
Index: main.c
===================================================================
RCS file: /var/lib/cvs/src/d2c/runtime/c-code/main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- main.c 3 Oct 2003 20:21:19 -0000 1.26
+++ main.c 2 Dec 2003 16:14:34 -0000 1.27
@@ -72,16 +72,18 @@
descriptor_t tmp;
descriptor_t *stack = gdb_stack_stack[gdb_stack_stack_index];
void **dylan_str;
+ size_t len = 0;
if (stack == 0)
stack = gdb_stack_stack[gdb_stack_stack_index]
= (descriptor_t *) malloc(GDB_STACK_SIZE);
+ len = strlen(arg);
dylan_str = (void **)
- GC_malloc(sizeof(struct heapobj *) + sizeof(long) + strlen(arg));
+ GC_malloc(sizeof(struct heapobj *) + sizeof(long) + len);
dylan_str[0] = (void *)(&dylanZdylan_visceraZCLS_byte_string_HEAP);
- dylan_str[1] = (void *)strlen(arg);
- strcpy((char *)(&dylan_str[2]), arg);
+ dylan_str[1] = (void *)len;
+ strncpy((char *)(&dylan_str[2]), arg, len);
tmp.heapptr = (struct heapobj *)dylan_str;
tmp.dataword.l = 0;
_______________________________________________
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
http://www.gwydiondylan.org/mailman/listinfo/gd-chatter
|
|