Commit 0a8590b2 authored by Peter Eisentraut's avatar Peter Eisentraut
parent f2898de9
...@@ -207,12 +207,12 @@ IsValidJsonNumber(const char *str, int len) ...@@ -207,12 +207,12 @@ IsValidJsonNumber(const char *str, int len)
*/ */
if (*str == '-') if (*str == '-')
{ {
dummy_lex.input = (char *) str + 1; dummy_lex.input = unconstify(char *, str) + 1;
dummy_lex.input_length = len - 1; dummy_lex.input_length = len - 1;
} }
else else
{ {
dummy_lex.input = (char *) str; dummy_lex.input = unconstify(char *, str);
dummy_lex.input_length = len; dummy_lex.input_length = len;
} }
......
...@@ -423,7 +423,7 @@ pg_get_keywords(PG_FUNCTION_ARGS) ...@@ -423,7 +423,7 @@ pg_get_keywords(PG_FUNCTION_ARGS)
HeapTuple tuple; HeapTuple tuple;
/* cast-away-const is ugly but alternatives aren't much better */ /* cast-away-const is ugly but alternatives aren't much better */
values[0] = (char *) ScanKeywords[funcctx->call_cntr].name; values[0] = unconstify(char *, ScanKeywords[funcctx->call_cntr].name);
switch (ScanKeywords[funcctx->call_cntr].category) switch (ScanKeywords[funcctx->call_cntr].category)
{ {
......
...@@ -182,7 +182,7 @@ char * ...@@ -182,7 +182,7 @@ char *
text_to_cstring(const text *t) text_to_cstring(const text *t)
{ {
/* must cast away the const, unfortunately */ /* must cast away the const, unfortunately */
text *tunpacked = pg_detoast_datum_packed((struct varlena *) t); text *tunpacked = pg_detoast_datum_packed(unconstify(text *, t));
int len = VARSIZE_ANY_EXHDR(tunpacked); int len = VARSIZE_ANY_EXHDR(tunpacked);
char *result; char *result;
...@@ -213,7 +213,7 @@ void ...@@ -213,7 +213,7 @@ void
text_to_cstring_buffer(const text *src, char *dst, size_t dst_len) text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)
{ {
/* must cast away the const, unfortunately */ /* must cast away the const, unfortunately */
text *srcunpacked = pg_detoast_datum_packed((struct varlena *) src); text *srcunpacked = pg_detoast_datum_packed(unconstify(text *, src));
size_t src_len = VARSIZE_ANY_EXHDR(srcunpacked); size_t src_len = VARSIZE_ANY_EXHDR(srcunpacked);
if (dst_len > 0) if (dst_len > 0)
......
...@@ -183,7 +183,7 @@ pgwin32_setlocale(int category, const char *locale) ...@@ -183,7 +183,7 @@ pgwin32_setlocale(int category, const char *locale)
* forbidden to modify, so casting away the "const" is innocuous. * forbidden to modify, so casting away the "const" is innocuous.
*/ */
if (result) if (result)
result = (char *) map_locale(locale_map_result, result); result = unconstify(char *, map_locale(locale_map_result, result));
return result; return result;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment