summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Pentchev <roam@ringlet.net>2023-07-14 16:17:07 +0300
committerPeter Pentchev <roam@debian.org>2023-07-14 16:17:07 +0300
commitd972e039e2f659301789dba3e81f46f6914606da (patch)
treecd5633058c2ceb70a40a8b55566c7fcd3fea3eb9
parentca308e0765d3483abfbc0da52bba2f5e84e41052 (diff)
Mark some C and C++ variables as constant.
Forwarded: yes Last-Update: 2021-11-14 Gbp-Pq: Name constify.patch
-rwxr-xr-xbomstrip.c6
-rwxr-xr-xbomstrip.cpp10
2 files changed, 8 insertions, 8 deletions
diff --git a/bomstrip.c b/bomstrip.c
index a5a831a..84f618f 100755
--- a/bomstrip.c
+++ b/bomstrip.c
@@ -4,19 +4,19 @@
#include <string.h>
char buf[BUFSIZ];
-const char *utf8bom = "\xef\xbb\xbf";
+const char * const utf8bom = "\xef\xbb\xbf";
static void usage(const char *);
static void
-usage(const char *prog)
+usage(const char * const prog)
{
fprintf(stderr, "usage: %s\n", prog);
exit(1);
}
int
-main(int argc, const char * const argv[])
+main(const int argc, const char * const argv[])
{
size_t nread;
diff --git a/bomstrip.cpp b/bomstrip.cpp
index 51ca93c..aec7b7f 100755
--- a/bomstrip.cpp
+++ b/bomstrip.cpp
@@ -6,20 +6,20 @@
using namespace std;
-const char *utf8bom = "\xef\xbb\xbf";
+const char * const utf8bom = "\xef\xbb\xbf";
static void usage(const char *);
-static void outendl(string &);
+static void outendl(const string &);
static void
-usage(const char *prog)
+usage(const char * const prog)
{
cerr << "usage: " << prog << endl;
exit(1);
}
static void
-outendl(string &s)
+outendl(const string &s)
{
cout << s;
if (!cin.eof())
@@ -27,7 +27,7 @@ outendl(string &s)
}
int
-main(int argc, const char * const argv[])
+main(const int argc, const char * const argv[])
{
string s;