postgresql/contrib/sepgsql
David Rowley 8b26769bc4 Fix an assortment of improper usages of string functions
In a similar effort to f736e188c and 110d81728, fixup various usages of
string functions where a more appropriate function is available and more
fit for purpose.

These changes include:

1. Use cstring_to_text_with_len() instead of cstring_to_text() when
   working with a StringInfoData and the length can easily be obtained.
2. Use appendStringInfoString() instead of appendStringInfo() when no
   formatting is required.
3. Use pstrdup(...) instead of psprintf("%s", ...)
4. Use pstrdup(...) instead of psprintf(...) (with no formatting)
5. Use appendPQExpBufferChar() instead of appendPQExpBufferStr() when the
   length of the string being appended is 1.
6. appendStringInfoChar() instead of appendStringInfo() when no formatting
   is required and string is 1 char long.
7. Use appendPQExpBufferStr(b, .) instead of appendPQExpBuffer(b, "%s", .)
8. Don't use pstrdup when it's fine to just point to the string constant.

I (David) did find other cases of #8 but opted to use #4 instead as I
wasn't certain enough that applying #8 was ok (e.g in hba.c)

Author: Ranier Vilela, David Rowley
Discussion: https://postgr.es/m/CAApHDvo2j2+RJBGhNtUz6BxabWWh2Jx16wMUMWKUjv70Ver1vg@mail.gmail.com
2022-09-06 13:19:44 +12:00
..
expected Include permissive/enforcing state in sepgsql log messages. 2022-01-12 14:23:13 -05:00
sql Remove gratuitous uses of deprecated SELECT INTO 2021-01-28 14:28:41 +01:00
.gitignore Minor sepgsql regression test fixes. 2011-02-02 23:46:51 -05:00
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
database.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
dml.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
hooks.c Remove now superfluous declarations of dlsym()ed symbols. 2022-07-17 17:29:32 -07:00
label.c Avoid casting away const in sepgsql's quote_object_name. 2022-08-27 12:52:39 -04:00
launcher Update copyright for 2022 2022-01-07 19:04:57 -05:00
proc.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
relation.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
schema.c Fix an assortment of improper usages of string functions 2022-09-06 13:19:44 +12:00
selinux.c Remove unused code from sepgsql 2022-09-02 20:38:34 +02:00
sepgsql-regtest.te Update sepgsql to add mandatory access control for TRUNCATE 2019-11-23 10:46:44 -05:00
sepgsql.h Remove unused code from sepgsql 2022-09-02 20:38:34 +02:00
sepgsql.sql.in sepgsql_setcon(). 2012-03-15 16:08:40 -04:00
test_sepgsql Update sepgsql to add mandatory access control for TRUNCATE 2019-11-23 10:46:44 -05:00
uavc.c Include permissive/enforcing state in sepgsql log messages. 2022-01-12 14:23:13 -05:00