linc-protocol: error in function decls, misplaced "const"



Hi,

A Debian user/developer, J.H.M. Dassen (Ray), called the following to
my attention.  In linc-protocol.{c,h}, several function are declared
as returning const pointers (which is meaningless -- function returns
aren't lvalues) rather than pointers-to-const.  The following patch
fixes the problem.  (Although it does cause some warnings in the test
code -- fixing that is left as an exercise for the maintainers.:)


diff -ru linc-orig/include/linc/linc-protocol.h linc/include/linc/linc-protocol.h
--- linc-orig/include/linc/linc-protocol.h	2002-06-12 09:46:39.000000000 -0700
+++ linc/include/linc/linc-protocol.h	2002-11-04 00:59:42.000000000 -0800
@@ -64,9 +64,9 @@
 	gpointer                    dummy[8];
 };
 
-LINCProtocolInfo * const linc_protocol_find     (const char *name);
-LINCProtocolInfo * const linc_protocol_find_num (const int   family);
-LINCProtocolInfo * const linc_protocol_all      (void);
+LINCProtocolInfo const * linc_protocol_find     (const char *name);
+LINCProtocolInfo const * linc_protocol_find_num (const int   family);
+LINCProtocolInfo const * linc_protocol_all      (void);
 char                    *linc_get_tmpdir        (void);
 void                     linc_set_tmpdir        (const char *dir);
 
diff -ru linc-orig/src/linc-protocols.c linc/src/linc-protocols.c
--- linc-orig/src/linc-protocols.c	2002-10-22 17:47:26.000000000 -0700
+++ linc/src/linc-protocols.c	2002-11-04 01:00:12.000000000 -0800
@@ -1110,7 +1110,7 @@
  *
  * Return Value: an array of #LINCProtocolInfo structures.
  */
-LINCProtocolInfo * const
+LINCProtocolInfo const *
 linc_protocol_all (void)
 {
 	return static_linc_protocols;
@@ -1125,7 +1125,7 @@
  * Return Value: a pointer to a valid #LINCProtocolInfo structure if 
  *               the protocol is supported by linc, NULL otherwise.
  */
-LINCProtocolInfo * const
+LINCProtocolInfo const *
 linc_protocol_find (const char *name)
 {
 	int i;
@@ -1147,7 +1147,7 @@
  * Return Value: a pointer to a valid #LINCProtocolInfo structure if
  *               the protocol is supported by linc, NULL otherwise.
  */
-LINCProtocolInfo * const
+LINCProtocolInfo const *
 linc_protocol_find_num (const int family)
 {
 	int i;

-- 
Chris Waters           |  Pneumonoultra-        osis is too long
xtifr@debian.org       |  microscopicsilico-    to fit into a single
or xtifr@speakeasy.net |  volcaniconi-          standalone haiku



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]