]> granicus.if.org Git - python/commit
Internal refactoring of convertsimple() and friends.
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 29 May 2001 17:37:05 +0000 (17:37 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 29 May 2001 17:37:05 +0000 (17:37 +0000)
commit1cb7aa3e6e0a7cf94938701ac1a027e1b5b25c1f
treed7c97c43c109d9e635f90ef88378d490e4b4e873
parent9cea41c195ee1067063c011f775f4f61ee463fa1
Internal refactoring of convertsimple() and friends.

Note that lots of code was re-indented.

Replace two-step of convertsimple() and convertsimple1() with
convertsimple() and helper converterr(), which is called to format
error messages when convertsimple() fails.  The old code did all the
real work in convertsimple1(), but deferred error message formatting
to conversimple().  The result was paying the price of a second
function call on every call just to format error messages in the
failure cases.

Factor out of the buffer-handling code in convertsimple() and package
it as convertbuffer().

Add two macros to ease readability of Unicode coversions,
UNICODE_DEFAULT_ENCODING() and CONV_UNICODE, an error string.

The convertsimple() routine had awful indentation problems, primarily
because there were two tabs between the case line and the body of the
case statements.  This patch reformats the entire function to have a
single tab between case line and case body, which makes the code
easier to read (and consistent with ceval).  The introduction of
converterr() exacerbated the problem and prompted this fix.

Also, eliminate non-standard whitespace after opening paren and before
closing paren in a few if statements.

(This checkin is part of SF patch 426072.)
Python/getargs.c