summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-11-28 20:27:42 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-11-28 20:27:42 (GMT)
commit885d457709c1d680c899dc3d035a47c8fb514cfa (patch)
treed16b3a6f89208a1b46b786958a316ef9075d3fab /Modules/arraymodule.c
parent05bd787c6cd55f29d43465de621778221e0fc46e (diff)
downloadcpython-885d457709c1d680c899dc3d035a47c8fb514cfa.zip
cpython-885d457709c1d680c899dc3d035a47c8fb514cfa.tar.gz
cpython-885d457709c1d680c899dc3d035a47c8fb514cfa.tar.bz2
sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the former didn't make sense.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 6168bb0..11d0723 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1313,12 +1313,13 @@ array_repr(arrayobject *a)
int i, len;
len = a->ob_size;
if (len == 0) {
- sprintf(buf, "array('%c')", a->ob_descr->typecode);
+ PyOS_snprintf(buf, sizeof(buf), "array('%c')",
+ a->ob_descr->typecode);
return PyString_FromString(buf);
}
if (a->ob_descr->typecode == 'c') {
PyObject *t_empty = PyTuple_New(0);
- sprintf(buf, "array('c', ");
+ PyOS_snprintf(buf, sizeof(buf), "array('c', ");
s = PyString_FromString(buf);
v = array_tostring(a, t_empty);
Py_DECREF(t_empty);
@@ -1328,7 +1329,7 @@ array_repr(arrayobject *a)
PyString_ConcatAndDel(&s, PyString_FromString(")"));
return s;
}
- sprintf(buf, "array('%c', [", a->ob_descr->typecode);
+ PyOS_snprintf(buf, sizeof(buf), "array('%c', [", a->ob_descr->typecode);
s = PyString_FromString(buf);
comma = PyString_FromString(", ");
for (i = 0; i < len && !PyErr_Occurred(); i++) {