From 660a33e11fd16b8f75cd68bc1423ff18883b0065 Mon Sep 17 00:00:00 2001
From: Masood Malekghassemi <soltanmm@users.noreply.github.com>
Date: Fri, 3 Apr 2015 10:38:44 -0700
Subject: [PATCH] Satisfy C90 pedantry in Python adapter

---
 src/python/src/grpc/_adapter/_call.c               | 2 +-
 src/python/src/grpc/_adapter/_call.h               | 2 +-
 src/python/src/grpc/_adapter/_channel.h            | 2 +-
 src/python/src/grpc/_adapter/_client_credentials.h | 2 +-
 src/python/src/grpc/_adapter/_completion_queue.c   | 5 +++--
 src/python/src/grpc/_adapter/_completion_queue.h   | 2 +-
 src/python/src/grpc/_adapter/_server.h             | 2 +-
 src/python/src/grpc/_adapter/_server_credentials.h | 2 +-
 8 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/python/src/grpc/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c
index f837267e9a..bf96c1a3fa 100644
--- a/src/python/src/grpc/_adapter/_call.c
+++ b/src/python/src/grpc/_adapter/_call.c
@@ -164,10 +164,10 @@ static const PyObject *pygrpc_call_add_metadata(Call *self, PyObject *args) {
   const char* key = NULL;
   const char* value = NULL;
   int value_length = 0;
+  grpc_metadata metadata;
   if (!PyArg_ParseTuple(args, "ss#", &key, &value, &value_length)) {
     return NULL;
   }
-  grpc_metadata metadata;
   metadata.key = key;
   metadata.value = value;
   metadata.value_length = value_length;
diff --git a/src/python/src/grpc/_adapter/_call.h b/src/python/src/grpc/_adapter/_call.h
index fabc6f399d..c04a2285f7 100644
--- a/src/python/src/grpc/_adapter/_call.h
+++ b/src/python/src/grpc/_adapter/_call.h
@@ -38,7 +38,7 @@
 #include <grpc/grpc.h>
 
 typedef struct {
-  PyObject_HEAD;
+  PyObject_HEAD
   grpc_call *c_call;
 } Call;
 
diff --git a/src/python/src/grpc/_adapter/_channel.h b/src/python/src/grpc/_adapter/_channel.h
index 303b675192..afc0f80359 100644
--- a/src/python/src/grpc/_adapter/_channel.h
+++ b/src/python/src/grpc/_adapter/_channel.h
@@ -38,7 +38,7 @@
 #include <grpc/grpc.h>
 
 typedef struct {
-  PyObject_HEAD;
+  PyObject_HEAD
   grpc_channel *c_channel;
 } Channel;
 
diff --git a/src/python/src/grpc/_adapter/_client_credentials.h b/src/python/src/grpc/_adapter/_client_credentials.h
index 47476ce15f..bb9f7f0c3a 100644
--- a/src/python/src/grpc/_adapter/_client_credentials.h
+++ b/src/python/src/grpc/_adapter/_client_credentials.h
@@ -38,7 +38,7 @@
 #include <grpc/grpc_security.h>
 
 typedef struct {
-  PyObject_HEAD;
+  PyObject_HEAD
   grpc_credentials *c_client_credentials;
 } ClientCredentials;
 
diff --git a/src/python/src/grpc/_adapter/_completion_queue.c b/src/python/src/grpc/_adapter/_completion_queue.c
index 76d6b6cb44..a639eff53e 100644
--- a/src/python/src/grpc/_adapter/_completion_queue.c
+++ b/src/python/src/grpc/_adapter/_completion_queue.c
@@ -124,7 +124,7 @@ static PyObject *pygrpc_metadata_collection_get(
     PyObject *key = PyString_FromString(elem.key);
     PyObject *value = PyString_FromStringAndSize(elem.value, elem.value_length);
     PyObject* kvp = PyTuple_Pack(2, key, value);
-    // n.b. PyList_SetItem *steals* a reference to the set element.
+    /* n.b. PyList_SetItem *steals* a reference to the set element. */
     PyList_SetItem(metadata, i, kvp);
     Py_DECREF(key);
     Py_DECREF(value);
@@ -266,6 +266,7 @@ static PyObject *pygrpc_finished_event_args(grpc_event *c_event) {
   PyObject *details;
   PyObject *status;
   PyObject *event_args;
+  PyObject *metadata;
 
   code = pygrpc_status_code(c_event->data.finished.status);
   if (code == NULL) {
@@ -285,7 +286,7 @@ static PyObject *pygrpc_finished_event_args(grpc_event *c_event) {
   if (status == NULL) {
     return NULL;
   }
-  PyObject* metadata = pygrpc_metadata_collection_get(
+  metadata = pygrpc_metadata_collection_get(
       c_event->data.finished.metadata_elements,
       c_event->data.finished.metadata_count);
   event_args = PyTuple_Pack(8, finish_event_kind, (PyObject *)c_event->tag,
diff --git a/src/python/src/grpc/_adapter/_completion_queue.h b/src/python/src/grpc/_adapter/_completion_queue.h
index 3a39476a2e..9b377d15d9 100644
--- a/src/python/src/grpc/_adapter/_completion_queue.h
+++ b/src/python/src/grpc/_adapter/_completion_queue.h
@@ -38,7 +38,7 @@
 #include <grpc/grpc.h>
 
 typedef struct {
-  PyObject_HEAD;
+  PyObject_HEAD
   grpc_completion_queue *c_completion_queue;
 } CompletionQueue;
 
diff --git a/src/python/src/grpc/_adapter/_server.h b/src/python/src/grpc/_adapter/_server.h
index 4248712c1c..4836bb638c 100644
--- a/src/python/src/grpc/_adapter/_server.h
+++ b/src/python/src/grpc/_adapter/_server.h
@@ -38,7 +38,7 @@
 #include <grpc/grpc.h>
 
 typedef struct {
-  PyObject_HEAD;
+  PyObject_HEAD
   grpc_server *c_server;
 } Server;
 
diff --git a/src/python/src/grpc/_adapter/_server_credentials.h b/src/python/src/grpc/_adapter/_server_credentials.h
index bb6ff2c5bb..6090404bd9 100644
--- a/src/python/src/grpc/_adapter/_server_credentials.h
+++ b/src/python/src/grpc/_adapter/_server_credentials.h
@@ -38,7 +38,7 @@
 #include <grpc/grpc_security.h>
 
 typedef struct {
-  PyObject_HEAD;
+  PyObject_HEAD
   grpc_server_credentials *c_server_credentials;
 } ServerCredentials;
 
-- 
GitLab