[nas] [patch] mark some readonly string/params as const
Stefan Huehner
stefan at huehner.org
Thu Aug 31 05:57:16 MDT 2006
Hi,
attached patch marks some read-only string and function parameters as
'const char*' instead of 'char *'. In Addition an unsued buffer
'errfile' from aulog.c was removed.
As the two release.h files are generated the NetAudio.tmpl was modified
to emit the 'const char *' declaration.
Regards,
Stefan
-------------- next part --------------
Index: config/NetAudio.tmpl
===================================================================
--- config/NetAudio.tmpl (revision 226)
+++ config/NetAudio.tmpl (working copy)
@@ -285,7 +285,7 @@
#ifndef WIN32
#define BuildReleaseHeader() @@\
release.h: $(TOP)/RELEASE @@\
- @echo "static char *release = \"`cat $(TOP)/RELEASE`\";" > $@ @@\
+ @echo "static const char *release = \"`cat $(TOP)/RELEASE`\";" > $@ @@\
@@\
depend:: release.h @@\
@@\
@@ -294,7 +294,7 @@
#else /* WIN32 */
#define BuildReleaseHeader() @@\
release.h: $(TOP)/RELEASE @@\
- @echo static char *release = "Windows NT"; > $@ @@\
+ @echo static const char *release = "Windows NT"; > $@ @@\
@@\
depend:: release.h @@\
@@\
Index: server/os/aulog.c
===================================================================
--- server/os/aulog.c (revision 226)
+++ server/os/aulog.c (working copy)
@@ -21,11 +21,10 @@
#endif
void
-osLogMsg(char *fmt, ...)
+osLogMsg(const char *fmt, ...)
{
va_list ap;
static char buf[LOG_BUFSIZE];
- static char errfile[LOG_FILENMSZ];
static FILE *errfd = NULL;
va_start(ap, fmt);
Index: server/os/aulog.h
===================================================================
--- server/os/aulog.h (revision 226)
+++ server/os/aulog.h (working copy)
@@ -12,6 +12,6 @@
#define LOG_BUFSIZE 4096
#define LOG_FILENMSZ 1024
-void osLogMsg(char *fmt, ...);
+void osLogMsg(const char *fmt, ...);
#endif /* AULOG_H_INCLUDED */
Index: server/dia/main.c
===================================================================
--- server/dia/main.c (revision 226)
+++ server/dia/main.c (working copy)
@@ -89,7 +89,7 @@
*/
static FILE *
-openConfigFile(char *path)
+openConfigFile(const char *path)
{
FILE *config;
@@ -104,7 +104,7 @@
main(int argc, char *argv[])
{
int i;
- char *config_file;
+ const char *config_file;
/* Notice if we're restart. Probably this is because we jumped through
* uninitialized pointer */
Index: server/dia/audispatch.c
===================================================================
--- server/dia/audispatch.c (revision 226)
+++ server/dia/audispatch.c (working copy)
@@ -1514,7 +1514,7 @@
AuInitSetupReply()
{
int len;
- char *rel = release;
+ const char *rel = release;
static char *string;
if (!AuInitDevice(&auSetup, &len))
More information about the Nas
mailing list