[Yt-svn] yt-commit r1086 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed Jan 7 17:34:19 PST 2009


Author: mturk
Date: Wed Jan  7 17:34:18 2009
New Revision: 1086
URL: http://yt.spacepope.org/changeset/1086

Log:
Removed unused variables, added some braces, fixed a potential segfault in the
fail for one of the routines, and initialized PyArrayObject *pointers to NULL.



Modified:
   trunk/yt/lagos/HDF5LightReader.c
   trunk/yt/lagos/PointCombine.c

Modified: trunk/yt/lagos/HDF5LightReader.c
==============================================================================
--- trunk/yt/lagos/HDF5LightReader.c	(original)
+++ trunk/yt/lagos/HDF5LightReader.c	Wed Jan  7 17:34:18 2009
@@ -89,7 +89,7 @@
     herr_t my_error;
     htri_t file_exists;
     size_t type_size;
-    int my_typenum, my_rank, i;
+    int my_rank, i;
     H5E_auto_t err_func;
     void *err_datastream;
     PyArrayObject *my_array = NULL;
@@ -230,9 +230,7 @@
     hid_t file_id, datatype_id, native_type_id, dataset, dataspace, memspace;
     herr_t my_error;
     htri_t file_exists;
-    H5T_class_t class_id;
-    size_t type_size;
-    int my_typenum, my_rank, i, axis, coord;
+    int my_rank, i, axis, coord;
     H5E_auto_t err_func;
     void *err_datastream;
     PyArrayObject *my_array = NULL;
@@ -392,8 +390,6 @@
     hid_t file_id;
     herr_t my_error;
     htri_t file_exists;
-    H5T_class_t class_id;
-    H5E_auto_t err_func;
     file_id = 0;
 
     if (!PyArg_ParseTuple(args, "ss",
@@ -445,7 +441,7 @@
 herr_t iterate_dataset(hid_t loc_id, const char *name, void *nodelist)
 {
     H5G_stat_t statbuf;
-    PyObject* node_name, node_list;
+    PyObject* node_name;
 
     H5Gget_objinfo(loc_id, name, 0, &statbuf);
     if (statbuf.type == H5G_DATASET) {
@@ -471,7 +467,6 @@
     // Format arguments
 
     char *filename = NULL;
-    char *format_string = NULL;
     PyObject *grid_ids = NULL;
     PyObject *set_names = NULL;
     Py_ssize_t num_sets = 0;
@@ -559,7 +554,7 @@
     hsize_t *my_dims = NULL;
     hsize_t *my_max_dims = NULL;
     npy_intp *dims = NULL;
-    int my_typenum, my_rank, i;
+    int my_rank, i;
     size_t type_size;
     PyArrayObject *my_array = NULL;
     hid_t datatype_id, native_type_id, dataset, dataspace;

Modified: trunk/yt/lagos/PointCombine.c
==============================================================================
--- trunk/yt/lagos/PointCombine.c	(original)
+++ trunk/yt/lagos/PointCombine.c	Wed Jan  7 17:34:18 2009
@@ -551,6 +551,7 @@
              *oc_le, *oc_re, *oc_dx, *oc_data, *odr_edge, *odl_edge;
     PyArrayObject *g_le, *g_dx, *g_cm,
                   *c_le, *c_re, *c_dx, *dr_edge, *dl_edge;
+    g_dx=g_cm=c_le=c_re=c_dx=NULL;
     PyArrayObject **g_data, **c_data;
     g_data = c_data = NULL;
     npy_int *ag_cm;
@@ -709,7 +710,6 @@
 
     npy_int64 xg, yg, zg, xc, yc, zc, cmax_x, cmax_y, cmax_z,
               cmin_x, cmin_y, cmin_z, cm, pxl, pyl, pzl;
-    npy_float64 *val1, *val2;
     long int total=0;
 
     int p_niter[3] = {1,1,1};
@@ -820,8 +820,8 @@
     Py_XDECREF(c_re);
     Py_XDECREF(c_dx);
     for(n=0;n<n_fields;n++) {
-        if(g_data!=NULL)Py_XDECREF(g_data[n]);
-        if(c_data!=NULL)Py_XDECREF(c_data[n]);
+        if(g_data[n]!=NULL){Py_XDECREF(g_data[n]);}
+        if(c_data[n]!=NULL){Py_XDECREF(c_data[n]);}
     }
     if(g_data!=NULL)free(g_data);
     if(c_data!=NULL)free(c_data);
@@ -872,6 +872,7 @@
 {
     PyObject *ocon_ids, *oxi, *oyi, *ozi;
     PyArrayObject *con_ids, *xi, *yi, *zi;
+    xi=yi=zi=con_ids=NULL;
     npy_int64 i, j, k, n;
 
     i = 0;
@@ -1079,6 +1080,7 @@
 {
     PyObject *omass, *ox, *oy, *oz;
     PyArrayObject *mass, *x, *y, *z;
+    x=y=z=mass=NULL;
     int truncate;
     double kinetic_energy;
 



More information about the yt-svn mailing list