summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorSjoerd Mullender <sjoerd@acm.org>1993-10-11 12:54:31 (GMT)
committerSjoerd Mullender <sjoerd@acm.org>1993-10-11 12:54:31 (GMT)
commita9c3c22c33762699b362e7598268442fd2df9eb6 (patch)
tree7ff6bdfb7228abf0a566b6d3215a383796bd5cbf /Objects/stringobject.c
parent35fe6ec4cf6e192829a5bd28c080761157258e3e (diff)
downloadcpython-a9c3c22c33762699b362e7598268442fd2df9eb6.zip
cpython-a9c3c22c33762699b362e7598268442fd2df9eb6.tar.gz
cpython-a9c3c22c33762699b362e7598268442fd2df9eb6.tar.bz2
* 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.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index cba8c92..a3043d4 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -35,9 +35,9 @@ newsizedstringobject(str, size)
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 @@ newstringobject(str)
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 @@ string_concat(a, bb)
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 @@ string_repeat(a, n)
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';