diff --git a/src/cpp.c b/src/cpp.c index 3d3c409f52571a8f7398532e597bb99d9a62c540..d19d04c6b61c88160f7865db6389f9e7cda2b2d0 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -1382,7 +1382,7 @@ static ptrdiff_t find_end_parenthesis(struct cpp *this, static ptrdiff_t find_end_brace(struct cpp *this, - PCHARP data, + const PCHARP data, ptrdiff_t len, ptrdiff_t pos) /* pos is after the open brace. Returns the position after the close brace. */ @@ -1425,7 +1425,7 @@ static inline int wide_isidchar( int c ) { return WIDE_ISIDCHAR(c); } -static struct pike_string *gobble_identifier (struct cpp *this, PCHARP data, ptrdiff_t *pos) +static struct pike_string *gobble_identifier (struct cpp *this, const PCHARP data, ptrdiff_t *pos) { ptrdiff_t p = *pos; struct string_builder sb; @@ -1553,7 +1553,7 @@ static struct define *alloc_empty_define(struct pike_string *name, *! @[#define], @[defined()] */ static void undefine(struct cpp *this, - struct pike_string *name) + const struct pike_string *name) { INT32 e; struct define *d; @@ -1604,7 +1604,7 @@ static void undefine(struct cpp *this, */ static struct define *do_magic_define(struct cpp *this, - char *name, + const char *name, magic_define_fun fun) { struct define* def; @@ -1639,8 +1639,8 @@ static void add_define(struct cpp *this, } static void simple_add_define(struct cpp *this, - char *name, - char *what) + const char *name, + const char *what) { struct define* def; @@ -1999,7 +1999,7 @@ static void free_one_define(struct hash_entry *h) ((begins_with(X,ADD_PCHARP(data,pos),sizeof(X),len-pos,0)) ? (pos += NELEM(X)),1 : 0) -static void add_quoted_string( void *str, ptrdiff_t len, int shift, +static void add_quoted_string( const void *str, ptrdiff_t len, int shift, struct string_builder *dst ) { struct pike_string *x = make_shared_binary_pcharp( MKPCHARP(str,shift), len ); @@ -2009,7 +2009,7 @@ static void add_quoted_string( void *str, ptrdiff_t len, int shift, free_string(x); } -static ptrdiff_t find_eos( struct cpp *this, PCHARP data, ptrdiff_t len, ptrdiff_t pos ) +static ptrdiff_t find_eos( struct cpp *this, const PCHARP data, ptrdiff_t len, ptrdiff_t pos ) { while(pos < len) { @@ -2043,7 +2043,7 @@ static ptrdiff_t find_eos( struct cpp *this, PCHARP data, ptrdiff_t len, ptrdiff return pos; } -static ptrdiff_t skipwhite(struct cpp *this, PCHARP data, ptrdiff_t pos) +static ptrdiff_t skipwhite(struct cpp *this, const PCHARP data, ptrdiff_t pos) { do { @@ -2077,7 +2077,7 @@ static ptrdiff_t skipwhite(struct cpp *this, PCHARP data, ptrdiff_t pos) return pos; } -static ptrdiff_t skipspace(struct cpp *this, PCHARP data, ptrdiff_t pos, int emit) +static ptrdiff_t skipspace(struct cpp *this, const PCHARP data, ptrdiff_t pos, int emit) { do { int c; @@ -2135,7 +2135,7 @@ static const char warning_[] = { 'w', 'a', 'r', 'n', 'i', 'n', 'g' }; static const char lsh_[] = { '<', '<' }; static const char rsh_[] = { '>', '>' }; -static int begins_with( const char *prefix, PCHARP stack, int len, int remain, int whole ) +static int begins_with( const char *prefix, const PCHARP stack, int len, int remain, int whole ) { int i; if( len > remain ) diff --git a/src/hashtable.c b/src/hashtable.c index e6eba7ac01b67bfc989bd9a86b382176b627a8b9..f9b0d96d759b30eecaa6feb6978af422f57f0a01 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -10,7 +10,7 @@ #include "stuff.h" #include "pike_error.h" -static size_t gobble(struct pike_string *s) +static size_t gobble(const struct pike_string *s) { size_t i; i=my_hash_string(s); @@ -23,7 +23,8 @@ static size_t gobble(struct pike_string *s) /* * Search hash for a specific string. */ -struct hash_entry *hash_lookup(struct hash_table *h, struct pike_string *s) +struct hash_entry *hash_lookup(const struct hash_table *h, + const struct pike_string *s) { struct hash_entry *e, **prev, **base; diff --git a/src/hashtable.h b/src/hashtable.h index ae1761f50fd54be993e22ddf7111ca5c48421b37..14f68c9bb9f183a742b64e11f11356164bea5bb8 100644 --- a/src/hashtable.h +++ b/src/hashtable.h @@ -32,7 +32,8 @@ struct hash_table }; /* Prototypes begin here */ -struct hash_entry *hash_lookup(struct hash_table *h, struct pike_string *s); +struct hash_entry *hash_lookup(const struct hash_table *h, + const struct pike_string *s); struct hash_table *create_hash_table(void); struct hash_table *hash_rehash(struct hash_table *h,int size); struct hash_table *hash_insert(struct hash_table *h, struct hash_entry *s);