Give every printf-like function restrict qualifiers

The format value has to be a string literal, every time.

Otherwise, you are not using these functions correctly. To reinforce this fact, I putrestrict over every non-contrib example of this I could find.
This commit is contained in:
Rose
2023-07-07 13:52:45 -04:00
parent 92860c717d
commit 5d758264ab
48 changed files with 143 additions and 143 deletions

View File

@@ -145,7 +145,7 @@ escape(char ch, char *buf)
* Any non-printable characters are escaped in octal as #0nn.
*/
bool
sudo_lbuf_append_esc_v1(struct sudo_lbuf *lbuf, int flags, const char *fmt, ...)
sudo_lbuf_append_esc_v1(struct sudo_lbuf *lbuf, int flags, const char * restrict fmt, ...)
{
unsigned int saved_len = lbuf->len;
bool ret = false;
@@ -220,7 +220,7 @@ done:
* Any characters in set are quoted with a backslash.
*/
bool
sudo_lbuf_append_quoted_v1(struct sudo_lbuf *lbuf, const char *set, const char *fmt, ...)
sudo_lbuf_append_quoted_v1(struct sudo_lbuf *lbuf, const char *set, const char * restrict fmt, ...)
{
unsigned int saved_len = lbuf->len;
bool ret = false;
@@ -279,7 +279,7 @@ done:
* Parse the format and append strings, only %s, %n$s and %% escapes are supported.
*/
bool
sudo_lbuf_append_v1(struct sudo_lbuf *lbuf, const char *fmt, ...)
sudo_lbuf_append_v1(struct sudo_lbuf *lbuf, const char * restrict fmt, ...)
{
unsigned int saved_len = lbuf->len;
bool ret = false;