diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1998-04-15 14:08:28 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1998-04-15 14:08:28 (GMT) |
commit | a239a92e102bd0bb1f98fda5fd45371755d66d41 (patch) | |
tree | b5bbd9b0374a06dd41df0de2d59f3c921ecc841d | |
parent | df3c6ab416df3765b7fca29f36d5fae6f72738ac (diff) | |
download | cpython-a239a92e102bd0bb1f98fda5fd45371755d66d41.zip cpython-a239a92e102bd0bb1f98fda5fd45371755d66d41.tar.gz cpython-a239a92e102bd0bb1f98fda5fd45371755d66d41.tar.bz2 |
Reindented some of the C code
-rw-r--r-- | Mac/Modules/snd/Sndmodule.c | 43 | ||||
-rw-r--r-- | Mac/Modules/snd/sndsupport.py | 43 |
2 files changed, 46 insertions, 40 deletions
diff --git a/Mac/Modules/snd/Sndmodule.c b/Mac/Modules/snd/Sndmodule.c index accb563..84d77e1 100644 --- a/Mac/Modules/snd/Sndmodule.c +++ b/Mac/Modules/snd/Sndmodule.c @@ -398,26 +398,29 @@ static int SPBObj_setattr(self, name, value) PyObject *value; { - if (strcmp(name, "inRefNum") == 0) - return PyArg_Parse(value, "l", &self->ob_spb.inRefNum); - else if (strcmp(name, "count") == 0) - return PyArg_Parse(value, "l", &self->ob_spb.count); - else if (strcmp(name, "milliseconds") == 0) - return PyArg_Parse(value, "l", &self->ob_spb.milliseconds); - else if (strcmp(name, "buffer") == 0) - return PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); - else if (strcmp(name, "completionRoutine") == 0) { - self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); - self->ob_completion = value; - Py_INCREF(value); - return 0; - } else if (strcmp(name, "interruptRoutine") == 0) { - self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); - self->ob_interrupt = value; - Py_INCREF(value); - return 0; - } - return -1; + int rv = 0; + + if (strcmp(name, "inRefNum") == 0) + rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum); + else if (strcmp(name, "count") == 0) + rv = PyArg_Parse(value, "l", &self->ob_spb.count); + else if (strcmp(name, "milliseconds") == 0) + rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds); + else if (strcmp(name, "buffer") == 0) + rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); + else if (strcmp(name, "completionRoutine") == 0) { + self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); + self->ob_completion = value; + Py_INCREF(value); + rv = 1; + } else if (strcmp(name, "interruptRoutine") == 0) { + self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); + self->ob_interrupt = value; + Py_INCREF(value); + rv = 1; + } + if ( rv ) return 0; + else return -1; } staticforward PyTypeObject SPB_Type = { diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py index cabfa27..279f22a 100644 --- a/Mac/Modules/snd/sndsupport.py +++ b/Mac/Modules/snd/sndsupport.py @@ -303,26 +303,29 @@ class SpbObjectDefinition(ObjectDefinition): def outputSetattrBody(self): Output(""" - if (strcmp(name, "inRefNum") == 0) - return PyArg_Parse(value, "l", &self->ob_spb.inRefNum); - else if (strcmp(name, "count") == 0) - return PyArg_Parse(value, "l", &self->ob_spb.count); - else if (strcmp(name, "milliseconds") == 0) - return PyArg_Parse(value, "l", &self->ob_spb.milliseconds); - else if (strcmp(name, "buffer") == 0) - return PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); - else if (strcmp(name, "completionRoutine") == 0) { - self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); - self->ob_completion = value; - Py_INCREF(value); - return 0; - } else if (strcmp(name, "interruptRoutine") == 0) { - self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); - self->ob_interrupt = value; - Py_INCREF(value); - return 0; - } - return -1;""") + int rv = 0; + + if (strcmp(name, "inRefNum") == 0) + rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum); + else if (strcmp(name, "count") == 0) + rv = PyArg_Parse(value, "l", &self->ob_spb.count); + else if (strcmp(name, "milliseconds") == 0) + rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds); + else if (strcmp(name, "buffer") == 0) + rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); + else if (strcmp(name, "completionRoutine") == 0) { + self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); + self->ob_completion = value; + Py_INCREF(value); + rv = 1; + } else if (strcmp(name, "interruptRoutine") == 0) { + self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); + self->ob_interrupt = value; + Py_INCREF(value); + rv = 1; + } + if ( rv ) return 0; + else return -1;""") def outputGetattrHook(self): Output(""" |