git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f2898de)
Apply unconstify() in more places
2018年10月24日 23:42:57 +0000 (00:42 +0100)
2018年10月25日 00:02:46 +0000 (01:02 +0100)
Discussion: https://www.postgresql.org/message-id/08adbe4e-38f8-2c73-55f0-591392371687%402ndquadrant.com


diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index 6f0fe94d63f26bba74b6853db9e58f8801c644df..f47a498228ea51a679061f63d62422e75e72beec 100644 (file)
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -207,12 +207,12 @@ IsValidJsonNumber(const char *str, int len)
*/
if (*str == '-')
{
- dummy_lex.input = (char *) str + 1;
+ dummy_lex.input = unconstify(char *, str) + 1;
dummy_lex.input_length = len - 1;
}
else
{
- dummy_lex.input = (char *) str;
+ dummy_lex.input = unconstify(char *, str);
dummy_lex.input_length = len;
}
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 6ea3679835bf2db499c7de73b57d48c235a99e5d..309eb2935c7ebffe8643cb253e622caba399f5db 100644 (file)
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -423,7 +423,7 @@ pg_get_keywords(PG_FUNCTION_ARGS)
HeapTuple tuple;
/* 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)
{
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index a5e812d026ccaa482329a3ba2fa21763d9ebe03a..0fd3b157482d8ae09a0a03de51f3e8556f287306 100644 (file)
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -182,7 +182,7 @@ char *
text_to_cstring(const text *t)
{
/* 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);
char *result;
@@ -213,7 +213,7 @@ void
text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)
{
/* 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);
if (dst_len > 0)
diff --git a/src/port/win32setlocale.c b/src/port/win32setlocale.c
index 0597c2afca4e376429e2ba07f0ccbaad6a6d1b47..a8cf170dd1598dfb65e5fe8d5d1f57e3d9ebf89e 100644 (file)
--- a/src/port/win32setlocale.c
+++ b/src/port/win32setlocale.c
@@ -183,7 +183,7 @@ pgwin32_setlocale(int category, const char *locale)
* forbidden to modify, so casting away the "const" is innocuous.
*/
if (result)
- result = (char *) map_locale(locale_map_result, result);
+ result = unconstify(char *, map_locale(locale_map_result, result));
return result;
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /