[GRASS-SVN] r50500 - in grass/trunk/lib/db: dbmi_base dbmi_client

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 27 11:55:16 EST 2012


Author: martinl
Date: 2012-01-27 08:55:15 -0800 (Fri, 27 Jan 2012)
New Revision: 50500

Modified:
   grass/trunk/lib/db/dbmi_base/cursor.c
   grass/trunk/lib/db/dbmi_base/string.c
   grass/trunk/lib/db/dbmi_client/c_fetch.c
   grass/trunk/lib/db/dbmi_client/c_openselect.c
   grass/trunk/lib/db/dbmi_client/db.c
Log:
dbmi: use G_zero() for initialization
      cosmetics in dox documentation


Modified: grass/trunk/lib/db/dbmi_base/cursor.c
===================================================================
--- grass/trunk/lib/db/dbmi_base/cursor.c	2012-01-27 15:38:59 UTC (rev 50499)
+++ grass/trunk/lib/db/dbmi_base/cursor.c	2012-01-27 16:55:15 UTC (rev 50500)
@@ -16,18 +16,14 @@
 #include <grass/dbmi.h>
 
 /*!
-  \brief Initialize cursor
+  \brief Initialize dbCursor
   
   \param cursor pointer to dbCursor to be initialized
 */
 void db_init_cursor(dbCursor *cursor)
 {
-    cursor->driver = NULL;
+    G_zero(cursor, sizeof(dbCursor));
     cursor->token = -1;
-    cursor->type = 0;
-    cursor->mode = 0;
-    cursor->table = NULL;
-    cursor->column_flags = NULL;
 }
 
 /*!

Modified: grass/trunk/lib/db/dbmi_base/string.c
===================================================================
--- grass/trunk/lib/db/dbmi_base/string.c	2012-01-27 15:38:59 UTC (rev 50499)
+++ grass/trunk/lib/db/dbmi_base/string.c	2012-01-27 16:55:15 UTC (rev 50500)
@@ -22,10 +22,9 @@
   
   \param[out] x pointer to dbString
  */
-void db_init_string(dbString * x)
+void db_init_string(dbString *x)
 {
-    x->string = NULL;
-    x->nalloc = 0;
+    G_zero(x, sizeof(dbString));
 }
 
 static int set_string(dbString * x, char *s, int copy);
@@ -144,11 +143,11 @@
 }
 
 /*!
-  \brief Free allocated space
+  \brief Free allocated space for dbString
 
-  \param x poiter to dbString
+  \param x pointer to dbString
 */
-void db_free_string(dbString * x)
+void db_free_string(dbString *x)
 {
     if (x->nalloc > 0)
 	db_free(x->string);

Modified: grass/trunk/lib/db/dbmi_client/c_fetch.c
===================================================================
--- grass/trunk/lib/db/dbmi_client/c_fetch.c	2012-01-27 15:38:59 UTC (rev 50499)
+++ grass/trunk/lib/db/dbmi_client/c_fetch.c	2012-01-27 16:55:15 UTC (rev 50500)
@@ -16,11 +16,11 @@
 #include "macros.h"
 
 /*!
-  \brief Fetch data
+  \brief Fetch data from open cursor
 
-  \param cursor db cursor
+  \param cursor pointer to dbCursor
   \param position cursor position
-  \param[out] more get more?
+  \param[out] more get more (0 for no data to be fetched)
 
   \return DB_OK on success
   \return DB_FAILED on failure

Modified: grass/trunk/lib/db/dbmi_client/c_openselect.c
===================================================================
--- grass/trunk/lib/db/dbmi_client/c_openselect.c	2012-01-27 15:38:59 UTC (rev 50499)
+++ grass/trunk/lib/db/dbmi_client/c_openselect.c	2012-01-27 16:55:15 UTC (rev 50500)
@@ -1,15 +1,16 @@
 /*!
- * \file db/dbmi_client/c_openselect.c
- * 
- * \brief DBMI Library (client) - open select cursor
- *
- * (C) 1999-2008 by the GRASS Development Team
- *
- * This program is free software under the GNU General Public
- * License (>=v2). Read the file COPYING that comes with GRASS
- * for details.
- *
- * \author Joel Jones (CERL/UIUC), Radim Blazek
+  \file db/dbmi_client/c_openselect.c
+  
+  \brief DBMI Library (client) - open select cursor
+  
+  (C) 1999-2008, 2012 by the GRASS Development Team
+ 
+  This program is free software under the GNU General Public
+  License (>=v2). Read the file COPYING that comes with GRASS
+  for details.
+  
+  \author Joel Jones (CERL/UIUC)
+  \author Radim Blazek
  */
 
 #include <grass/dbmi.h>
@@ -21,9 +22,13 @@
   Open modes:
    - DB_SEQUENTIAL
 
-  \param driver db driver
-  \param select SQL select statement
-  \param cursor db cursor to be opened
+  Data can be fetched by db_fetch().
+  
+  Cursor should be closed by db_close_cursor().
+  
+  \param driver pointer to dbDriver
+  \param select SQL select statement (pointer to dbString)
+  \param cursor pointer to dbCursor to be opened
   \param mode open mode
 
   \return DB_OK on success

Modified: grass/trunk/lib/db/dbmi_client/db.c
===================================================================
--- grass/trunk/lib/db/dbmi_client/db.c	2012-01-27 15:38:59 UTC (rev 50499)
+++ grass/trunk/lib/db/dbmi_client/db.c	2012-01-27 16:55:15 UTC (rev 50500)
@@ -31,7 +31,7 @@
     dbHandle handle;
     dbDriver *driver;
 
-    G_debug(3, "db_start_driver_open_database():\n  drvname = %s, dbname = %s",
+    G_debug(3, "db_start_driver_open_database(): drvname='%s', dbname='%s'",
 	    drvname, dbname);
 
     db_init_handle(&handle);



More information about the grass-commit mailing list