summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-08-04 02:34:41 (GMT)
committerFred Drake <fdrake@acm.org>2000-08-04 02:34:41 (GMT)
commitc76e0e56794b6c5a405bd6da476c42e72a4cfda8 (patch)
tree226b97f3cdf2b716cfdc8828d8044dcc5b6037f8 /Objects/rangeobject.c
parentf813e59d496b1048d68a759cd913818d9b61112c (diff)
downloadcpython-c76e0e56794b6c5a405bd6da476c42e72a4cfda8.zip
cpython-c76e0e56794b6c5a405bd6da476c42e72a4cfda8.tar.gz
cpython-c76e0e56794b6c5a405bd6da476c42e72a4cfda8.tar.bz2
snprintf() is not portable, so continue to use sprintf() until a portable
snprintf() is available.
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index ad9824f..8c208e9 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -65,21 +65,19 @@ range_repr(rangeobject *r)
char buf2[80];
if (r->start == 0 && r->step == 1) {
- snprintf(buf1, sizeof(buf1), "xrange(%ld)",
- r->start + r->len * r->step);
+ sprintf(buf1, "xrange(%ld)", r->start + r->len * r->step);
}
else {
char *fmt = "xrange(%ld, %ld, %ld)";
if (r->step == 1)
fmt = "xrange(%ld, %ld)";
- snprintf(buf1, sizeof(buf1), fmt,
- r->start,
- r->start + r->len * r->step,
- r->step);
+ sprintf(buf1, fmt,
+ r->start,
+ r->start + r->len * r->step,
+ r->step);
}
if (r->reps != 1) {
- snprintf(buf2, sizeof(buf2),
- "(%s * %d)", buf1, r->reps);
+ sprintf(buf2, "(%s * %d)", buf1, r->reps);
}
return PyString_FromString(r->reps == 1 ? buf1 : buf2);
}