[GRASS-SVN] r47408 - in grass/trunk: include lib/gis sites/s.in.ascii

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 3 16:28:58 EDT 2011


Author: martinl
Date: 2011-08-03 13:28:58 -0700 (Wed, 03 Aug 2011)
New Revision: 47408

Modified:
   grass/trunk/include/gisdefs.h
   grass/trunk/lib/gis/strings.c
   grass/trunk/sites/s.in.ascii/get_site.c
Log:
gislib: G_squeeze return type char * -> void
	string.c: clean up doxygen


Modified: grass/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h	2011-08-03 20:14:37 UTC (rev 47407)
+++ grass/trunk/include/gisdefs.h	2011-08-03 20:28:58 UTC (rev 47408)
@@ -584,7 +584,7 @@
 void G_str_to_upper(char *);
 void G_str_to_lower(char *);
 int G_str_to_sql(char *);
-char *G_squeeze(char *);
+void G_squeeze(char *);
 
 /* tempfile.c */
 void G_init_tempfile(void);

Modified: grass/trunk/lib/gis/strings.c
===================================================================
--- grass/trunk/lib/gis/strings.c	2011-08-03 20:14:37 UTC (rev 47407)
+++ grass/trunk/lib/gis/strings.c	2011-08-03 20:28:58 UTC (rev 47408)
@@ -1,20 +1,20 @@
 /*!
- * \file strings.c
- * 
- * \brief GIS Library - string/chring movement functions
- *
- * \todo merge interesting functions from ../datetime/scan.c here
- *
- * (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 Dave Gerdes (USACERL), Michael Shapiro (USACERL), Amit
- * Parghi (USACERL), Bernhard Reiter (Intevation GmbH, Germany) and
- * many others
- */
+  \file lib/gis/strings.c
+  
+  \brief GIS Library - string/chring movement functions
+  
+  \todo merge interesting functions from ../datetime/scan.c here
+  
+  (C) 1999-2008, 2011 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 Dave Gerdes (USACERL)
+  \author Michael Shapiro (USACERL)
+  \author Amit Parghi (USACERL)
+  \author Bernhard Reiter (Intevation GmbH, Germany) and many others
+*/
 
 #include <string.h>
 #include <stdlib.h>
@@ -27,17 +27,20 @@
 #endif
 
 /*!
- * \brief String compare ignoring case (upper or lower)
- *
- * Returning a value that has the same sign as the difference between
- * the first differing pair of characters
- *
- * \param[in] x first string to compare
- * \param[in] y second string to compare
- *
- * \return 0 the two strings are equal
- * \return -1, 1
- */
+  \brief String compare ignoring case (upper or lower)
+  
+  Returning a value that has the same sign as the difference between
+  the first differing pair of characters.
+
+  Note: strcasecmp() is affected by the locale (LC_CTYPE), while
+  G_strcasecmp() isn't.
+  
+  \param x first string to compare
+  \param y second string to compare
+  
+  \return 0 the two strings are equal
+  \return -1, 1
+*/
 int G_strcasecmp(const char *x, const char *y)
 {
     int xx, yy;
@@ -66,19 +69,18 @@
 }
 
 /*!
- * \brief Copy string to allocated memory.
- *
- * This routine allocates enough memory to hold the string <b>s</b>,
- * copies <b>s</b> to the allocated memory, and returns a pointer
- * to the allocated memory.
- *
- * If <em>s</em> is NULL then empty string is returned.
- *
- *  \param s string
- *
- *  \return pointer to newly allocated string
- */
-
+  \brief Copy string to allocated memory.
+  
+  This routine allocates enough memory to hold the string <b>s</b>,
+  copies <em>s</em> to the allocated memory, and returns a pointer
+  to the allocated memory.
+  
+  If <em>s</em> is NULL then empty string is returned.
+  
+  \param s string
+ 
+  \return pointer to newly allocated string
+*/
 char *G_store(const char *s)
 {
     char *buf;
@@ -96,14 +98,14 @@
 }
 
 /*!
- * \brief Replace all occurencies of character in string bug with new
- *
- * \param[in,out] bug base string
- * \param[in] character character to replace
- * \param[in] new new character
- *
- * \return bug string
- */
+  \brief Replace all occurencies of character in string bug with new
+  
+  \param[in,out] bug base string
+  \param character character to replace
+  \param new new character
+  
+  \return bug string
+*/
 char *G_strchg(char *bug, char character, char new)
 {
     char *help = bug;
@@ -117,26 +119,26 @@
 }
 
 /*!
- * \brief Replace all occurencies of old_str in buffer with new_str
- *
- * Code example:
- * \code
- * char *name;
- * name = G_str_replace ( inbuf, ".exe", "" );
- * ... 
- * G_free (name);
- * \endcode
- *
- * \param buffer input string buffer
- * \param old_str string to be replaced
- * \param new_str new string
- *
- * \return the newly allocated string, input buffer is unchanged 
- */
+  \brief Replace all occurencies of old_str in buffer with new_str
+  
+  Code example:
+  \code
+  char *name;
+  name = G_str_replace ( inbuf, ".exe", "" );
+  ... 
+  G_free (name);
+  \endcode
+  
+  \param buffer input string buffer
+  \param old_str string to be replaced
+  \param new_str new string
+  
+  \return the newly allocated string, input buffer is unchanged 
+*/
 char *G_str_replace(const char *buffer, const char *old_str, const char *new_str)
 {
-    char *B, *R;
-    const char *N;
+    char *R;
+    const char *N, *B;
     char *replace;
     int count, len;
 
@@ -199,12 +201,10 @@
 }
 
 /*!
- * \brief Removes all leading and trailing white space from string.
- *
- * \param[in,out] buf buffer to be worked on
- *
- * \return
- */
+  \brief Removes all leading and trailing white space from string.
+  
+  \param[in,out] buf buffer to be worked on
+*/
 void G_strip(char *buf)
 {
     char *a, *b;
@@ -223,15 +223,16 @@
 }
 
 /*!
- * \brief Chop leading and trailing white spaces:
- * \verbatim space, \f, \n, \r, \t, \v \endverbatim
- *
- * modified copy of G_squeeze();    RB March 2000 <Radim.Blazek at dhv.cz>
- *
- * \param line buffer to be worked on
- *
- * \return pointer to string
- */
+  \brief Chop leading and trailing white spaces.
+  
+  \verbatim space, \f, \n, \r, \t, \v \endverbatim
+  
+  Modified copy of G_squeeze() by RB in March 2000.
+  
+  \param line buffer to be worked on
+  
+  \return pointer to string
+*/
 char *G_chop(char *line)
 {
     char *f = line, *t = line;
@@ -258,10 +259,10 @@
 }
 
 /*!
- * \brief Convert string to upper case
- *
- * \param[in,out] str pointer to string
- */
+  \brief Convert string to upper case
+  
+  \param[in,out] str pointer to string
+*/
 void G_str_to_upper(char *str)
 {
     int i = 0;
@@ -276,10 +277,10 @@
 }
 
 /*!
- * \brief Convert string to lower case
- *
- * \param[in,out] str pointer to string
- */
+  \brief Convert string to lower case
+  
+  \param[in,out] str pointer to string
+*/
 void G_str_to_lower(char *str)
 {
     int i = 0;
@@ -294,12 +295,12 @@
 }
 
 /*!
- * \brief Make string SQL compliant
- *
- * \param[in,out] str pointer to string
- *
- * \return number of changed characters
- */
+  \brief Make string SQL compliant
+  
+  \param[in,out] str pointer to string
+  
+  \return number of changed characters
+*/
 int G_str_to_sql(char *str)
 {
     int count;
@@ -332,18 +333,18 @@
 }
 
 /*!
- * \brief Remove superfluous white space.
- *
- * Leading and trailing white space is removed from the string 
- * <b>line</b> and internal white space which is more than one character 
- * is reduced to a single space character. White space here means 
- * spaces, tabs, linefeeds, newlines, and formfeeds.
- *
- * \param[in,out] line
- * \return Pointer to <b>line</b>
- */
+  \brief Remove superfluous white space.
+  
+  Leading and trailing white space is removed from the string 
+  <b>line</b> and internal white space which is more than one character 
+  is reduced to a single space character. White space here means 
+  spaces, tabs, linefeeds, newlines, and formfeeds.
+  
+  \param[in,out] line
 
-char *G_squeeze(char *line)
+  \return Pointer to <b>line</b>
+*/
+void G_squeeze(char *line)
 {
     char *f = line, *t = line;
     int l;
@@ -362,6 +363,4 @@
     l = strlen(line) - 1;
     if (*(line + l) == '\n')
 	*(line + l) = '\0';
-
-    return line;
 }

Modified: grass/trunk/sites/s.in.ascii/get_site.c
===================================================================
--- grass/trunk/sites/s.in.ascii/get_site.c	2011-08-03 20:14:37 UTC (rev 47407)
+++ grass/trunk/sites/s.in.ascii/get_site.c	2011-08-03 20:28:58 UTC (rev 47408)
@@ -80,7 +80,7 @@
 
 	buf = save;
 	strcpy(buf, ibuf);
-	buf = G_squeeze(buf);
+	G_squeeze(buf);
 
 	if (*buf == 0)
 	    return (Site *) NULL;



More information about the grass-commit mailing list