diff Objects/stringobject.c @ 1347:a22a350d3a5d legacy-trunk

* Extended X interface: pixmap objects, colormap objects visual objects, image objects, and lots of new methods. * Added counting of allocations and deallocations of builtin types if COUNT_ALLOCS is defined. Had to move calls to NEWREF down in some files. * Bug fix in sorting lists.
author Sjoerd Mullender <sjoerd@acm.org>
date Mon, 11 Oct 1993 12:54:31 +0000
parents 6ee380349c84
children 043da19302ef
line wrap: on
line diff
--- a/Objects/stringobject.c	Mon Oct 11 12:39:15 1993 +0000
+++ b/Objects/stringobject.c	Mon Oct 11 12:54:31 1993 +0000
@@ -35,9 +35,9 @@
 		malloc(sizeof(stringobject) + size * sizeof(char));
 	if (op == NULL)
 		return err_nomem();
-	NEWREF(op);
 	op->ob_type = &Stringtype;
 	op->ob_size = size;
+	NEWREF(op);
 	if (str != NULL)
 		memcpy(op->ob_sval, str, size);
 	op->ob_sval[size] = '\0';
@@ -53,9 +53,9 @@
 		malloc(sizeof(stringobject) + size * sizeof(char));
 	if (op == NULL)
 		return err_nomem();
-	NEWREF(op);
 	op->ob_type = &Stringtype;
 	op->ob_size = size;
+	NEWREF(op);
 	strcpy(op->ob_sval, str);
 	return (object *) op;
 }
@@ -187,9 +187,9 @@
 		malloc(sizeof(stringobject) + size * sizeof(char));
 	if (op == NULL)
 		return err_nomem();
-	NEWREF(op);
 	op->ob_type = &Stringtype;
 	op->ob_size = size;
+	NEWREF(op);
 	memcpy(op->ob_sval, a->ob_sval, (int) a->ob_size);
 	memcpy(op->ob_sval + a->ob_size, b->ob_sval, (int) b->ob_size);
 	op->ob_sval[size] = '\0';
@@ -216,9 +216,9 @@
 		malloc(sizeof(stringobject) + size * sizeof(char));
 	if (op == NULL)
 		return err_nomem();
-	NEWREF(op);
 	op->ob_type = &Stringtype;
 	op->ob_size = size;
+	NEWREF(op);
 	for (i = 0; i < size; i += a->ob_size)
 		memcpy(op->ob_sval+i, a->ob_sval, (int) a->ob_size);
 	op->ob_sval[size] = '\0';