]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
safe_printf should annotate with restrict (#2605)
authorAZero13 <gfunni234@gmail.com>
Thu, 15 May 2025 01:24:54 +0000 (21:24 -0400)
committerGitHub <noreply@github.com>
Thu, 15 May 2025 01:24:54 +0000 (18:24 -0700)
printf has restrict for its parameters, and safe_printf should do the
same.

tar/bsdtar.h
tar/util.c

index 65ab969b830f95174a2d96e05f86847a657ea812..ac995c82b3bcf559cb0344ba447c03a609f0d2cd 100644 (file)
@@ -182,7 +182,7 @@ void        do_chdir(struct bsdtar *);
 int    edit_pathname(struct bsdtar *, struct archive_entry *);
 int    need_report(void);
 int    pathcmp(const char *a, const char *b);
-void   safe_fprintf(FILE *, const char *fmt, ...) __LA_PRINTF(2, 3);
+void   safe_fprintf(FILE * restrict, const char * restrict fmt, ...) __LA_PRINTF(2, 3);
 void   set_chdir(struct bsdtar *, const char *newdir);
 const char *tar_i64toa(int64_t);
 void   tar_mode_c(struct bsdtar *bsdtar);
index a63883527d0b452c8725276628a6be18d255200e..39d5c452e633915af282374c273f87c015d68124 100644 (file)
@@ -72,7 +72,7 @@ static const char *strip_components(const char *path, int elements);
  */
 
 void
-safe_fprintf(FILE *f, const char *fmt, ...)
+safe_fprintf(FILE * restrict f, const char * restrict fmt, ...)
 {
        char fmtbuff_stack[256]; /* Place to format the printf() string. */
        char outbuff[256]; /* Buffer for outgoing characters. */