1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
From 7d21d7f469d90c2d55b23926c866bba635aa7e6f Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 14 Feb 2016 18:05:49 -0500
Subject: [PATCH] report/oops: constify format strings
---
src/headers/gpm.h | 4 ++--
src/headers/message.h | 2 +-
src/lib/report-lib.c | 4 ++--
src/prog/mouse-test.c | 2 +-
src/report.c | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/headers/gpm.h b/src/headers/gpm.h
index 57dc618..9e96deb 100644
--- a/src/headers/gpm.h
+++ b/src/headers/gpm.h
@@ -280,10 +280,10 @@ int Gpm_GetSnapshot(Gpm_Event *ePtr);
char *Gpm_get_console( void );
int Gpm_x_high_y(int base, int pot_y);
int Gpm_cnt_digits(int number);
-void gpm_oops(int line, char *file, char *text, ... );
+void gpm_oops(int line, const char *file, const char *text, ... );
/* report.c / report-lib.c */
-void gpm_report(int line, char *file, int stat, char *text, ... );
+void gpm_report(int line, const char *file, int stat, const char *text, ... );
#ifdef __cplusplus
};
diff --git a/src/headers/message.h b/src/headers/message.h
index a0fed0e..25cad8c 100644
--- a/src/headers/message.h
+++ b/src/headers/message.h
@@ -226,7 +226,7 @@
/* #define GPM_MESS_ "" */
/* functions */
-void gpm_report(int line, char *file, int stat, char *text, ... );
+void gpm_report(int line, const char *file, int stat, const char *text, ... );
/* rest of wd.h */
#ifdef HAVE_SYSLOG_H
diff --git a/src/lib/report-lib.c b/src/lib/report-lib.c
index c0ae086..b565b77 100644
--- a/src/lib/report-lib.c
+++ b/src/lib/report-lib.c
@@ -24,9 +24,9 @@
#include "headers/message.h"
-void gpm_report(int line, char *file, int stat, char *text, ... )
+void gpm_report(int line, const char *file, int stat, const char *text, ... )
{
- char *string = NULL;
+ const char *string = NULL;
int log_level;
va_list ap;
diff --git a/src/prog/mouse-test.c b/src/prog/mouse-test.c
index 0bb1982..ab8d602 100644
--- a/src/prog/mouse-test.c
+++ b/src/prog/mouse-test.c
@@ -182,7 +182,7 @@ Gpm_Type *(*I_serial)(int fd, unsigned short flags, struct Gpm_Type *type,
/*-----------------------------------------------------------------------------
Place the description here.
-----------------------------------------------------------------------------*/
-int mousereopen(int oldfd, char *name, Gpm_Type *type)
+int mousereopen(int oldfd, const char *name, Gpm_Type *type)
{
int fd;
if (!type) type=mice+1; /* ms */
diff --git a/src/report.c b/src/report.c
index 6c7c2ee..286c1b7 100644
--- a/src/report.c
+++ b/src/report.c
@@ -69,7 +69,7 @@
*
*/
-void gpm_report(int line, char *file, int stat, char *text, ... )
+void gpm_report(int line, const char *file, int stat, const char *text, ...)
{
FILE *console = NULL;
va_list ap, ap3;
|