[Python-checkins] r86281 - python/branches/py3k/PC/winsound.c

hirokazu.yamamoto python-checkins at python.org
Sun Nov 7 03:45:19 CET 2010


Author: hirokazu.yamamoto
Date: Sun Nov  7 03:45:19 2010
New Revision: 86281

Log:
Formatted code. (Tabify, etc)

Modified:
   python/branches/py3k/PC/winsound.c

Modified: python/branches/py3k/PC/winsound.c
==============================================================================
--- python/branches/py3k/PC/winsound.c	(original)
+++ python/branches/py3k/PC/winsound.c	Sun Nov  7 03:45:19 2010
@@ -77,24 +77,23 @@
     int length;
     int ok;
 
-    if(!PyArg_ParseTuple(args,"z#i:PlaySound",&sound,&length,&flags)) {
-    return NULL;
+    if (!PyArg_ParseTuple(args, "z#i:PlaySound", &sound, &length, &flags)) {
+        return NULL;
     }
 
-    if(flags&SND_ASYNC && flags &SND_MEMORY) {
-    /* Sidestep reference counting headache; unfortunately this also
-       prevent SND_LOOP from memory. */
-    PyErr_SetString(PyExc_RuntimeError,"Cannot play asynchronously from memory");
-    return NULL;
+    if (flags & SND_ASYNC && flags & SND_MEMORY) {
+        /* Sidestep reference counting headache; unfortunately this also
+           prevent SND_LOOP from memory. */
+        PyErr_SetString(PyExc_RuntimeError, "Cannot play asynchronously from memory");
+        return NULL;
     }
 
     Py_BEGIN_ALLOW_THREADS
-    ok = PlaySound(sound,NULL,flags);
+    ok = PlaySound(sound, NULL, flags);
     Py_END_ALLOW_THREADS
-    if(!ok)
-    {
-    PyErr_SetString(PyExc_RuntimeError,"Failed to play sound");
-    return NULL;
+    if (!ok) {
+        PyErr_SetString(PyExc_RuntimeError, "Failed to play sound");
+        return NULL;
     }
 
     Py_INCREF(Py_None);
@@ -151,11 +150,10 @@
 static void
 add_define(PyObject *dict, const char *key, long value)
 {
-    PyObject *k=PyUnicode_FromString(key);
-    PyObject *v=PyLong_FromLong(value);
-    if(v&&k)
-    {
-    PyDict_SetItem(dict,k,v);
+    PyObject *k = PyUnicode_FromString(key);
+    PyObject *v = PyLong_FromLong(value);
+    if (v && k) {
+        PyDict_SetItem(dict,k,v);
     }
     Py_XDECREF(k);
     Py_XDECREF(v);


More information about the Python-checkins mailing list