Guido van Rossum added the comment: Well, you could ensure that by checking that you haven't reached the end of the mangling buffer. That will have the added advantage that when the input is something silly like 32 spaces followed by "utf-8" it will be still be mangled correctly. The slight extra cost of the check (could be a single pointer compare) is offset by saving a call to strncpy().
--Guido On 10/13/07, Christian Heimes <[EMAIL PROTECTED]> wrote: > > Christian Heimes added the comment: > > Guido van Rossum wrote: > > - Why copy the default encoding before mangling it? With a little extra > > care you will only have to copy it once. > > Now I remember why I added the strncpy() call plus encoding[31] = '\0'. > I wanted to make sure that the code doesn't break even if the encoding > name is longer than 31 + 1 chars long. I'm aware that it's very unlikely > but I didn't want to take chances. You are allowed to call me paranoid. *g* > > Christian > > __________________________________ > Tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue1272> > __________________________________ > __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1272> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com