Skip to content

Commit f6cb90b

Browse files
committed
Copy string copy/concat/format changes from libcups v3.
Remove all unnecessary string function checks. Remove old snprintf emulation functions (now require C99 which always has it)
1 parent 881eab1 commit f6cb90b

15 files changed

Lines changed: 464 additions & 816 deletions

File tree

config-scripts/cups-common.m4

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ AC_CHECK_HEADER([sys/statvfs.h], AC_DEFINE([HAVE_SYS_STATVFS_H], [1], [Have <sys
155155
AC_CHECK_HEADER([sys/vfs.h], AC_DEFINE([HAVE_SYS_VFS_H], [1], [Have <sys/vfs.h> header?]))
156156
AC_CHECK_FUNCS([statfs statvfs])
157157

158-
dnl Checks for string functions.
159-
dnl TODO: Remove strdup, snprintf, and vsnprintf checks since they are C99?
160-
AC_CHECK_FUNCS([strdup snprintf vsnprintf])
161-
AC_CHECK_FUNCS([cupsConcatString cupsCopyString])
162-
163158
dnl Check for random number functions...
164159
AC_CHECK_FUNCS([random lrand48 arc4random])
165160

config.h.in

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Configuration file for CUPS.
33
*
4-
* Copyright © 2020-2023 by OpenPrinting
4+
* Copyright © 2020-2024 by OpenPrinting
55
* Copyright © 2007-2019 by Apple Inc.
66
* Copyright © 1997-2007 by Easy Software Products.
77
*
@@ -177,15 +177,6 @@
177177
#endif /* !HAVE_STRTOLL */
178178

179179

180-
/*
181-
* Do we have the strXXX() functions?
182-
*/
183-
184-
#undef HAVE_STRDUP
185-
#undef HAVE_STRLCAT
186-
#undef HAVE_STRLCPY
187-
188-
189180
/*
190181
* Do we have the geteuid() function?
191182
*/
@@ -214,14 +205,6 @@
214205
#undef HAVE_SYSTEMD_SD_JOURNAL_H
215206

216207

217-
/*
218-
* Do we have the (v)snprintf() functions?
219-
*/
220-
221-
#undef HAVE_SNPRINTF
222-
#undef HAVE_VSNPRINTF
223-
224-
225208
/*
226209
* What wait functions to use?
227210
*/

configure

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6235,39 +6235,6 @@ then :
62356235
fi
62366236

62376237

6238-
ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
6239-
if test "x$ac_cv_func_strdup" = xyes
6240-
then :
6241-
printf "%s\n" "#define HAVE_STRDUP 1" >>confdefs.h
6242-
6243-
fi
6244-
ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
6245-
if test "x$ac_cv_func_snprintf" = xyes
6246-
then :
6247-
printf "%s\n" "#define HAVE_SNPRINTF 1" >>confdefs.h
6248-
6249-
fi
6250-
ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
6251-
if test "x$ac_cv_func_vsnprintf" = xyes
6252-
then :
6253-
printf "%s\n" "#define HAVE_VSNPRINTF 1" >>confdefs.h
6254-
6255-
fi
6256-
6257-
ac_fn_c_check_func "$LINENO" "cupsConcatString" "ac_cv_func_cupsConcatString"
6258-
if test "x$ac_cv_func_cupsConcatString" = xyes
6259-
then :
6260-
printf "%s\n" "#define HAVE_CUPSCONCATSTRING 1" >>confdefs.h
6261-
6262-
fi
6263-
ac_fn_c_check_func "$LINENO" "cupsCopyString" "ac_cv_func_cupsCopyString"
6264-
if test "x$ac_cv_func_cupsCopyString" = xyes
6265-
then :
6266-
printf "%s\n" "#define HAVE_CUPSCOPYSTRING 1" >>confdefs.h
6267-
6268-
fi
6269-
6270-
62716238
ac_fn_c_check_func "$LINENO" "random" "ac_cv_func_random"
62726239
if test "x$ac_cv_func_random" = xyes
62736240
then :

cups/Dependencies

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,6 @@ request.o: request.c cups-private.h string-private.h ../config.h \
816816
\
817817
language-private.h ../cups/transcode.h pwg-private.h ../cups/pwg.h \
818818
thread.h cups.h
819-
snprintf.o: snprintf.c string-private.h ../config.h ../cups/base.h
820819
string.o: string.c cups-private.h string-private.h ../config.h \
821820
../cups/base.h debug-internal.h debug-private.h ipp-private.h \
822821
../cups/cups.h file.h base.h ipp.h http.h array.h language.h pwg.h \
@@ -1505,7 +1504,8 @@ testdest.o: testdest.c cups.h file.h base.h ipp.h http.h array.h \
15051504
testdnssd.o: testdnssd.c test-internal.h dnssd.h cups.h file.h base.h \
15061505
ipp.h http.h array.h language.h pwg.h thread.h
15071506
testfile.o: testfile.c string-private.h ../config.h ../cups/base.h \
1508-
debug-private.h file.h base.h dir.h
1507+
debug-private.h cups.h file.h base.h ipp.h http.h array.h language.h \
1508+
pwg.h dir.h test-internal.h
15091509
testform.o: testform.c form.h cups.h file.h base.h ipp.h http.h array.h \
15101510
language.h pwg.h test-internal.h
15111511
testgetdests.o: testgetdests.c cups.h file.h base.h ipp.h http.h array.h \

cups/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ COREOBJS = \
5353
raster-stream.o \
5454
raster-stubs.o \
5555
request.o \
56-
snprintf.o \
5756
string.o \
5857
tempfile.o \
5958
thread.o \
@@ -474,8 +473,7 @@ libcups2.def: $(LIBOBJS) $(IMAGEOBJS) Makefile
474473
echo "VERSION 2.15" >>libcups2.def
475474
echo "EXPORTS" >>libcups2.def
476475
(nm $(LIBOBJS) $(IMAGEOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}'; \
477-
echo __cups_strcpy; echo __cups_cupsConcatString; echo __cups_cupsCopyString; \
478-
echo __cups_snprintf; echo __cups_vsnprintf; echo __cups_gettimeofday) | \
476+
echo __cups_strcpy; echo __cups_gettimeofday) | \
479477
grep -v -E \
480478
-e 'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel|SNMP' \
481479
-e 'Block$$' | \

cups/cups.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ extern ipp_attribute_t *cupsFindDestReady(http_t *http, cups_dest_t *dest, cups_
419419
extern ipp_attribute_t *cupsFindDestSupported(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, const char *option) _CUPS_PUBLIC;
420420
extern ipp_status_t cupsFinishDestDocument(http_t *http, cups_dest_t *dest, cups_dinfo_t *info) _CUPS_PUBLIC;
421421
extern ipp_status_t cupsFinishDocument(http_t *http, const char *name) _CUPS_PUBLIC;
422+
extern ssize_t cupsFormatString(char *buffer, size_t bufsize, const char *format, ...) _CUPS_FORMAT(3,4) _CUPS_PUBLIC;
423+
extern ssize_t cupsFormatStringv(char *buffer, size_t bufsize, const char *format, va_list ap) _CUPS_PUBLIC;
422424
extern void cupsFreeDestInfo(cups_dinfo_t *dinfo) _CUPS_PUBLIC;
423425
extern void cupsFreeDests(int num_dests, cups_dest_t *dests) _CUPS_PUBLIC;
424426
extern void cupsFreeJobs(int num_jobs, cups_job_t *jobs) _CUPS_PUBLIC;

0 commit comments

Comments
 (0)