[Pcre-svn] [567] code/trunk: Added some "const" qualifiers t…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [567] code/trunk: Added some "const" qualifiers to variables in pcre2grep.
Revision: 567
          http://www.exim.org/viewvc/pcre2?view=rev&revision=567
Author:   ph10
Date:     2016-10-14 16:47:27 +0100 (Fri, 14 Oct 2016)
Log Message:
-----------
Added some "const" qualifiers to variables in pcre2grep.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2grep.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-10-14 15:16:39 UTC (rev 566)
+++ code/trunk/ChangeLog    2016-10-14 15:47:27 UTC (rev 567)
@@ -72,7 +72,9 @@
 done by editing config.h), pcre2grep was giving a JIT error. Now it detects
 this situation and does not try to use JIT.


+12. Added some "const" qualifiers to variables in pcre2grep.

+
Version 10.22 29-July-2016
--------------------------


Modified: code/trunk/src/pcre2grep.c
===================================================================
--- code/trunk/src/pcre2grep.c    2016-10-14 15:16:39 UTC (rev 566)
+++ code/trunk/src/pcre2grep.c    2016-10-14 15:47:27 UTC (rev 567)
@@ -158,15 +158,16 @@
 static const char *jfriedl_postfix = "";
 #endif


-static char *colour_string = (char *)"1;31";
-static char *colour_option = NULL;
-static char *dee_option = NULL;
-static char *DEE_option = NULL;
-static char *locale = NULL;
+static const char *colour_string = (char *)"1;31";
+static const char *colour_option = NULL;
+static const char *dee_option = NULL;
+static const char *DEE_option = NULL;
+static const char *locale = NULL;
+static const char *newline_arg = NULL;
+static const char *om_separator = (char *)"";
+static const char *stdin_name = (char *)"(standard input)";
+
static char *main_buffer = NULL;
-static char *newline_arg = NULL;
-static char *om_separator = (char *)"";
-static char *stdin_name = (char *)"(standard input)";

static int after_context = 0;
static int before_context = 0;
@@ -1423,7 +1424,7 @@

static void
do_after_lines(int lastmatchnumber, char *lastmatchrestart, char *endptr,
- char *printname)
+ const char *printname)
{
if (after_context > 0 && lastmatchnumber > 0)
{
@@ -1829,7 +1830,7 @@
*/

static int
-pcre2grep(void *handle, int frtype, char *filename, char *printname)
+pcre2grep(void *handle, int frtype, const char *filename, const char *printname)
{
int rc = 1;
int linenumber = 1;
@@ -2894,7 +2895,7 @@
{
int linenumber = 0;
FILE *f;
-char *filename;
+const char *filename;
char buffer[PATBUFSIZE];

if (strcmp(name, "-") == 0)