[Python-checkins] r54116 - sandbox/trunk/pep3101/unicodeformat.c

patrick.maupin python-checkins at python.org
Sun Mar 4 18:48:00 CET 2007


Author: patrick.maupin
Date: Sun Mar  4 18:47:54 2007
New Revision: 54116

Modified:
   sandbox/trunk/pep3101/unicodeformat.c
Log:
Removed compile warnings and bugs

Modified: sandbox/trunk/pep3101/unicodeformat.c
==============================================================================
--- sandbox/trunk/pep3101/unicodeformat.c	(original)
+++ sandbox/trunk/pep3101/unicodeformat.c	Sun Mar  4 18:47:54 2007
@@ -36,7 +36,7 @@
 #define CH_TYPE                  char
 #define CH_TYPE_ISDECIMAL(x)     ((x >= '0') && (x <= '9'))
 #define CH_TYPE_TODECIMAL(x)     (CH_TYPE_ISDECIMAL(x) ? (x - '0') : -1)
-#define CH_TYPE_FILL             Py_UNICODE_FILL
+#define CH_TYPE_FILL             memset
 #define STROBJ_AS_PTR            PyString_AS_STRING
 #define STROBJ_GET_SIZE          PyString_GET_SIZE
 #define STROBJ_NEW               PyString_FromStringAndSize
@@ -755,7 +755,6 @@
 output_string_chars(FmtState *fs, CH_TYPE *src, Py_ssize_t len,
                     const InternalFormatSpec *format)
 {
-    Py_ssize_t ok;
     Py_ssize_t width; /* total field width */
     CH_TYPE *dst;
 
@@ -857,7 +856,6 @@
 format_char(PyObject *fieldobj, FmtState *fs,
             const InternalFormatSpec *format)
 {
-    int ok;
     CH_TYPE buf;
 
     if (PyString_Check(fieldobj)) {
@@ -1254,7 +1252,6 @@
 static int
 do_markup(FmtState *fs)
 {
-    SubString fmtstr;
     CH_TYPE c, *start, *ptr, *end;
     Py_ssize_t count;
     int syntaxmode, escape;
@@ -1268,7 +1265,7 @@
             switch (c = *ptr++) {
                 case '{':
                     if ((syntaxmode == 2) &&
-                        ((ptr == start) || (fmtstr.ptr[-2] != '$')))
+                        ((ptr == start) || (ptr[-2] != '$')))
                         continue;
                     break;
                 case '}':
@@ -1299,7 +1296,7 @@
                     break;
                 case 2:
                     count -= 2;
-                    escape = !count || (fmtstr.ptr[-3] != '$');
+                    escape = !count || (ptr[-3] != '$');
                     if (!escape)
                         ptr--;
                     break;


More information about the Python-checkins mailing list