]> granicus.if.org Git - python/commitdiff
Reindented some of the C code
authorJack Jansen <jack.jansen@cwi.nl>
Wed, 15 Apr 1998 14:08:28 +0000 (14:08 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Wed, 15 Apr 1998 14:08:28 +0000 (14:08 +0000)
Mac/Modules/snd/Sndmodule.c
Mac/Modules/snd/sndsupport.py

index accb563b36242922ef51089c1d3f0a423ce593ef..84d77e1c5fc9097e4c7ed9729afb4e40a1fccf5e 100644 (file)
@@ -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 = {
index cabfa2720ea2070e64d03d4984abf725ab85e3f1..279f22a4812a6704ff76c0d815958b16462dd1d0 100644 (file)
@@ -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("""