]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add new array APIs, remove old private array header, update unit tests, update
authorMichael R Sweet <msweet@msweet.org>
Sun, 10 Sep 2023 22:48:17 +0000 (18:48 -0400)
committerMichael R Sweet <msweet@msweet.org>
Sun, 10 Sep 2023 23:06:34 +0000 (19:06 -0400)
ippfind to use new array and DNS-SD APIs, update other code as needed to not
use deprecated APIs.

28 files changed:
backend/Dependencies
backend/ipp.c
berkeley/Dependencies
cups/Dependencies
cups/Makefile
cups/array-private.h [deleted file]
cups/array.c
cups/array.h
cups/cups-private.h
cups/ppd-cache.c
cups/testarray.c
filter/Dependencies
locale/Dependencies
man/mantohtml.c
monitor/Dependencies
notifier/Dependencies
ppdc/Dependencies
scheduler/Dependencies
scheduler/client.c
scheduler/conf.c
scheduler/util.c
scheduler/util.h
systemv/Dependencies
tools/Dependencies
tools/ippeveprinter.c
tools/ippfind.c
vcnet/libcups2.vcxproj
vcnet/libcups2.vcxproj.filters

index cbee7204202f37d653875101e9c00e1b2766c933..40e77aeecd18b9689e74e228534b53519268a7c7 100644 (file)
@@ -1,9 +1,9 @@
 ipp.o: ipp.c backend-private.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -53,15 +53,16 @@ lpd.o: lpd.c ../cups/http-private.h ../config.h ../cups/language.h \
   \
   \
   backend-private.h ../cups/cups-private.h ../cups/string-private.h \
-  ../cups/array-private.h ../cups/language-private.h ../cups/transcode.h \
-  ../cups/pwg-private.h ../cups/thread.h ../cups/snmp-private.h \
-  ../cups/backend.h ../cups/sidechannel.h
+  ../cups/debug-internal.h ../cups/debug-private.h \
+  ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
+  ../cups/thread.h ../cups/snmp-private.h ../cups/backend.h \
+  ../cups/sidechannel.h
 dnssd.o: dnssd.c backend-private.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -87,10 +88,10 @@ dnssd.o: dnssd.c backend-private.h ../cups/cups-private.h \
   ../cups/sidechannel.h
 snmp.o: snmp.c backend-private.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -139,14 +140,16 @@ socket.o: socket.c ../cups/http-private.h ../config.h ../cups/language.h \
   \
   \
   backend-private.h ../cups/cups-private.h ../cups/string-private.h \
-  ../cups/array-private.h ../cups/language-private.h ../cups/transcode.h \
-  ../cups/pwg-private.h ../cups/thread.h ../cups/snmp-private.h \
-  ../cups/backend.h ../cups/sidechannel.h
+  ../cups/debug-internal.h ../cups/debug-private.h \
+  ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
+  ../cups/thread.h ../cups/snmp-private.h ../cups/backend.h \
+  ../cups/sidechannel.h
 test1284.o: test1284.c ../cups/string-private.h ../config.h \
   ../cups/versioning.h ieee1284.c backend-private.h \
-  ../cups/cups-private.h ../cups/array-private.h ../cups/array.h \
-  ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  ../cups/cups-private.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
   \
   \
   \
@@ -176,8 +179,8 @@ testbackend.o: testbackend.c ../cups/string-private.h ../config.h \
   ../cups/versioning.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
   ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
   ../cups/sidechannel.h backend-private.h ../cups/cups-private.h \
-  ../cups/array-private.h ../cups/ipp-private.h ../cups/http-private.h \
-  \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -202,10 +205,10 @@ testbackend.o: testbackend.c ../cups/string-private.h ../config.h \
   ../cups/thread.h ../cups/snmp-private.h ../cups/backend.h
 testsupplies.o: testsupplies.c backend-private.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -231,10 +234,10 @@ testsupplies.o: testsupplies.c backend-private.h ../cups/cups-private.h \
   ../cups/sidechannel.h
 usb.o: usb.c backend-private.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -257,6 +260,5 @@ usb.o: usb.c backend-private.h ../cups/cups-private.h \
   \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h ../cups/snmp-private.h ../cups/backend.h \
-  ../cups/sidechannel.h usb-darwin.c ../cups/debug-private.h \
-  ../cups/file-private.h ../cups/ppd-private.h ../cups/ppd.h \
-  ../cups/raster.h
+  ../cups/sidechannel.h usb-darwin.c ../cups/file-private.h \
+  ../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h
index 7402fd4aa1aa0ce32517abff352d4b68d60a9111..5a624b3ca6a8a6e78609c75fcff1963a20dd6685 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "backend-private.h"
 #include <cups/ppd-private.h>
-#include <cups/array-private.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -333,7 +332,7 @@ main(int  argc,                             /* I - Number of command-line args */
   if ((auth_info_required = getenv("AUTH_INFO_REQUIRED")) == NULL)
     auth_info_required = "none";
 
-  state_reasons = _cupsArrayNewStrings(getenv("PRINTER_STATE_REASONS"), ',');
+  state_reasons = cupsArrayNewStrings(getenv("PRINTER_STATE_REASONS"), ',');
 
 #ifdef HAVE_GSSAPI
  /*
@@ -3549,7 +3548,7 @@ update_reasons(ipp_attribute_t *attr,     /* I - printer-state-reasons or NULL */
     else
       op = '\0';
 
-    new_reasons = _cupsArrayNewStrings(s, ',');
+    new_reasons = cupsArrayNewStrings(s, ',');
   }
   else
     return;
index 2ac7c49a30f943bf2136673dfe760c439dc9631c..c17e622a68979aee6ce39ff6d8c8636a4506c454 100644 (file)
@@ -1,8 +1,8 @@
 lpc.o: lpc.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
-  ../cups/versioning.h ../cups/array-private.h ../cups/array.h \
+  ../cups/versioning.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -26,10 +26,10 @@ lpc.o: lpc.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 lpq.o: lpq.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
-  ../cups/versioning.h ../cups/array-private.h ../cups/array.h \
+  ../cups/versioning.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -53,10 +53,10 @@ lpq.o: lpq.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 lpr.o: lpr.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
-  ../cups/versioning.h ../cups/array-private.h ../cups/array.h \
+  ../cups/versioning.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -80,10 +80,11 @@ lpr.o: lpr.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 lprm.o: lprm.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
index 5451a75742c5800e6146f958087e0fff89eecf09..d576a3fda90b67ca9db52f90300ca692e77ac08d 100644 (file)
@@ -1,9 +1,9 @@
 array.o: array.c ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h string-private.h ../config.h ../cups/versioning.h \
-  debug-internal.h debug-private.h array-private.h ../cups/array.h
+  debug-internal.h debug-private.h
 auth.o: auth.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -26,11 +26,10 @@ auth.o: auth.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 debug.o: debug.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -53,11 +52,10 @@ debug.o: debug.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 dest.o: dest.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -80,11 +78,11 @@ dest.o: dest.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  dnssd.h
 dest-job.o: dest-job.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -107,11 +105,10 @@ dest-job.o: dest-job.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 dest-localization.o: dest-localization.c cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
-  versioning.h ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
+  ipp-private.h ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -134,11 +131,10 @@ dest-localization.o: dest-localization.c cups-private.h string-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 dest-options.o: dest-options.c cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
-  versioning.h ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
+  ipp-private.h ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -161,13 +157,13 @@ dest-options.o: dest-options.c cups-private.h string-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
-dir.o: dir.c string-private.h ../config.h ../cups/versioning.h \
-  debug-internal.h debug-private.h dir.h versioning.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
+dir.o: dir.c cups.h file.h versioning.h ipp.h http.h array.h language.h \
+  pwg.h string-private.h ../config.h ../cups/versioning.h \
+  debug-internal.h debug-private.h dir.h
 dnssd.o: dnssd.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -190,11 +186,11 @@ dnssd.o: dnssd.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h dnssd.h cups.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  dnssd.h
 encode.o: encode.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -217,11 +213,10 @@ encode.o: encode.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 file.o: file.c file-private.h cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -244,11 +239,10 @@ file.o: file.c file-private.h cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 getputfile.o: getputfile.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -271,11 +265,10 @@ getputfile.o: getputfile.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 globals.o: globals.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -298,11 +291,10 @@ globals.o: globals.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 hash.o: hash.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -325,11 +317,11 @@ hash.o: hash.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
   md5-internal.h
 http.o: http.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -352,11 +344,10 @@ http.o: http.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 http-addr.o: http-addr.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -379,11 +370,10 @@ http-addr.o: http-addr.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 http-addrlist.o: http-addrlist.c cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
-  versioning.h ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
+  ipp-private.h ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -406,11 +396,10 @@ http-addrlist.o: http-addrlist.c cups-private.h string-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 http-support.o: http-support.c cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
-  versioning.h ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
+  ipp-private.h ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -433,11 +422,11 @@ http-support.o: http-support.c cups-private.h string-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  dnssd.h
 ipp.o: ipp.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -460,14 +449,13 @@ ipp.o: ipp.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 ipp-file.o: ipp-file.c ipp-private.h ../cups/cups.h file.h versioning.h \
   ipp.h http.h array.h language.h pwg.h string-private.h ../config.h \
   ../cups/versioning.h debug-internal.h debug-private.h
 ipp-vars.o: ipp-vars.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -490,11 +478,10 @@ ipp-vars.o: ipp-vars.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 ipp-support.o: ipp-support.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -517,11 +504,10 @@ ipp-support.o: ipp-support.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 langprintf.o: langprintf.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -544,11 +530,10 @@ langprintf.o: langprintf.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 language.o: language.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -571,8 +556,7 @@ language.o: language.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 md5.o: md5.c md5-internal.h ../cups/versioning.h string-private.h \
   ../config.h
 md5passwd.o: md5passwd.c ../cups/cups.h file.h versioning.h ipp.h http.h \
@@ -600,8 +584,8 @@ md5passwd.o: md5passwd.c ../cups/cups.h file.h versioning.h ipp.h http.h \
   \
   string-private.h ../cups/versioning.h
 notify.o: notify.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -624,11 +608,10 @@ notify.o: notify.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 options.o: options.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -651,11 +634,10 @@ options.o: options.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 pwg-media.o: pwg-media.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -678,11 +660,10 @@ pwg-media.o: pwg-media.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 raster-error.o: raster-error.c cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
-  versioning.h ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
+  ipp-private.h ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -705,9 +686,9 @@ raster-error.o: raster-error.c cups-private.h string-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  raster-private.h raster.h cups.h ../cups/debug-private.h \
-  ../cups/string-private.h debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  raster-private.h raster.h ../cups/debug-private.h \
+  ../cups/string-private.h
 raster-stream.o: raster-stream.c raster-private.h raster.h cups.h file.h \
   versioning.h ipp.h http.h array.h language.h pwg.h ../cups/cups.h \
   ../cups/debug-private.h ../cups/versioning.h ../cups/string-private.h \
@@ -717,8 +698,8 @@ raster-stubs.o: raster-stubs.c raster-private.h raster.h cups.h file.h \
   ../cups/debug-private.h ../cups/versioning.h ../cups/string-private.h \
   ../config.h
 request.o: request.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -741,12 +722,11 @@ request.o: request.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 snprintf.o: snprintf.c string-private.h ../config.h ../cups/versioning.h
 string.o: string.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -769,11 +749,10 @@ string.o: string.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 tempfile.o: tempfile.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -796,10 +775,10 @@ tempfile.o: tempfile.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 thread.o: thread.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -822,10 +801,10 @@ thread.o: thread.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 tls.o: tls.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -848,12 +827,12 @@ tls.o: tls.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h tls-openssl.c \
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  tls-openssl.c \
  
 transcode.o: transcode.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -876,11 +855,10 @@ transcode.o: transcode.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 usersys.o: usersys.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -903,11 +881,10 @@ usersys.o: usersys.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 util.o: util.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -930,11 +907,10 @@ util.o: util.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 adminutil.o: adminutil.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -957,13 +933,13 @@ adminutil.o: adminutil.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h ppd.h cups.h raster.h adminutil.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd.h raster.h adminutil.h
 backchannel.o: backchannel.c cups.h file.h versioning.h ipp.h http.h \
   array.h language.h pwg.h sidechannel.h
 backend.o: backend.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -986,11 +962,11 @@ backend.o: backend.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  backend.h ppd.h cups.h raster.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  backend.h ppd.h raster.h
 getdevices.o: getdevices.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1013,12 +989,12 @@ getdevices.o: getdevices.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h adminutil.h cups.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  adminutil.h
 getifaddrs.o: getifaddrs.c getifaddrs-internal.h ../config.h versioning.h
 ppd.o: ppd.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1041,12 +1017,11 @@ ppd.o: ppd.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 ppd-attr.o: ppd-attr.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1069,12 +1044,11 @@ ppd-attr.o: ppd-attr.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 ppd-cache.o: ppd-cache.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1097,12 +1071,11 @@ ppd-cache.o: ppd-cache.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 ppd-conflicts.o: ppd-conflicts.c cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
-  versioning.h ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
+  ipp-private.h ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1125,12 +1098,11 @@ ppd-conflicts.o: ppd-conflicts.c cups-private.h string-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 ppd-custom.o: ppd-custom.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1153,12 +1125,11 @@ ppd-custom.o: ppd-custom.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 ppd-emit.o: ppd-emit.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1181,11 +1152,11 @@ ppd-emit.o: ppd-emit.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h ppd.h cups.h raster.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd.h raster.h
 ppd-localize.o: ppd-localize.c cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
-  versioning.h ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
+  ipp-private.h ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1208,12 +1179,11 @@ ppd-localize.o: ppd-localize.c cups-private.h string-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 ppd-mark.o: ppd-mark.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1236,15 +1206,14 @@ ppd-mark.o: ppd-mark.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 ppd-page.o: ppd-page.c string-private.h ../config.h ../cups/versioning.h \
   debug-internal.h debug-private.h ppd.h cups.h file.h versioning.h \
   ipp.h http.h array.h language.h pwg.h raster.h
 ppd-util.o: ppd-util.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1267,9 +1236,8 @@ ppd-util.o: ppd-util.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h debug-internal.h \
-  debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h
 raster-interpret.o: raster-interpret.c ../cups/raster-private.h raster.h \
   cups.h file.h versioning.h ipp.h http.h array.h language.h pwg.h \
   ../cups/cups.h ../cups/debug-private.h ../cups/versioning.h \
@@ -1279,8 +1247,8 @@ raster-interstub.o: raster-interstub.c ../cups/ppd-private.h \
   ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h ../cups/ppd.h cups.h raster.h pwg-private.h
 sidechannel.o: sidechannel.c sidechannel.h versioning.h cups-private.h \
-  string-private.h ../config.h ../cups/versioning.h array-private.h \
-  ../cups/array.h ipp-private.h ../cups/cups.h file.h ipp.h http.h \
+  string-private.h ../config.h ../cups/versioning.h debug-internal.h \
+  debug-private.h ipp-private.h ../cups/cups.h file.h ipp.h http.h \
   array.h language.h pwg.h http-private.h ../cups/language.h \
   ../cups/http.h \
   \
@@ -1303,11 +1271,10 @@ sidechannel.o: sidechannel.c sidechannel.h versioning.h cups-private.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 snmp.o: snmp.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1330,8 +1297,8 @@ snmp.o: snmp.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  snmp-private.h debug-internal.h debug-private.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  snmp-private.h
 raster-interstub.o: raster-interstub.c ../cups/ppd-private.h \
   ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h ../cups/ppd.h cups.h raster.h pwg-private.h
@@ -1348,12 +1315,12 @@ testadmin.o: testadmin.c adminutil.h cups.h file.h versioning.h ipp.h \
   http.h array.h language.h pwg.h string-private.h ../config.h \
   ../cups/versioning.h
 testarray.o: testarray.c string-private.h ../config.h \
-  ../cups/versioning.h debug-private.h array-private.h ../cups/array.h \
-  versioning.h dir.h
+  ../cups/versioning.h debug-private.h cups.h file.h versioning.h ipp.h \
+  http.h array.h language.h pwg.h dir.h test-internal.h
 testcache.o: testcache.c ppd-private.h ../cups/cups.h file.h versioning.h \
   ipp.h http.h array.h language.h pwg.h ../cups/ppd.h cups.h raster.h \
   pwg-private.h file-private.h cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
   ipp-private.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1384,8 +1351,8 @@ testconflicts.o: testconflicts.c cups.h file.h versioning.h ipp.h http.h \
   array.h language.h pwg.h ppd.h raster.h string-private.h ../config.h \
   ../cups/versioning.h
 testcreds.o: testcreds.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1408,10 +1375,11 @@ testcreds.o: testcreds.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  test-internal.h
 testcups.o: testcups.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1434,8 +1402,8 @@ testcups.o: testcups.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h ppd.h \
-  cups.h raster.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd.h raster.h
 testdest.o: testdest.c cups.h file.h versioning.h ipp.h http.h array.h \
   language.h pwg.h
 testdnssd.o: testdnssd.c test-internal.h dnssd.h cups.h file.h \
@@ -1443,10 +1411,10 @@ testdnssd.o: testdnssd.c test-internal.h dnssd.h cups.h file.h \
 testfile.o: testfile.c string-private.h ../config.h ../cups/versioning.h \
   debug-private.h file.h versioning.h dir.h
 testgetdests.o: testgetdests.c cups.h file.h versioning.h ipp.h http.h \
-  array.h language.h pwg.h
+  array.h language.h pwg.h test-internal.h
 testhttp.o: testhttp.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1469,15 +1437,17 @@ testhttp.o: testhttp.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h
-testi18n.o: testi18n.c string-private.h ../config.h ../cups/versioning.h \
-  language-private.h ../cups/transcode.h language.h array.h versioning.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  test-internal.h
+testi18n.o: testi18n.c cups.h file.h versioning.h ipp.h http.h array.h \
+  language.h pwg.h string-private.h ../config.h ../cups/versioning.h \
+  language-private.h ../cups/transcode.h
 testipp.o: testipp.c file.h versioning.h string-private.h ../config.h \
   ../cups/versioning.h ipp-private.h ../cups/cups.h ipp.h http.h array.h \
   language.h pwg.h
 testoptions.o: testoptions.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1500,10 +1470,10 @@ testoptions.o: testoptions.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
 testlang.o: testlang.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1526,11 +1496,11 @@ testlang.o: testlang.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h ../cups/dir.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h ../cups/dir.h
 testppd.o: testppd.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1553,13 +1523,13 @@ testppd.o: testppd.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
-  ppd-private.h ../cups/ppd.h cups.h raster.h raster-private.h \
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
+  ppd-private.h ../cups/ppd.h raster.h raster-private.h \
   ../cups/debug-private.h ../cups/string-private.h
 testpwg.o: testpwg.c ppd-private.h ../cups/cups.h file.h versioning.h \
   ipp.h http.h array.h language.h pwg.h ../cups/ppd.h cups.h raster.h \
   pwg-private.h file-private.h cups-private.h string-private.h \
-  ../config.h ../cups/versioning.h array-private.h ../cups/array.h \
+  ../config.h ../cups/versioning.h debug-internal.h debug-private.h \
   ipp-private.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1588,8 +1558,8 @@ testraster.o: testraster.c ../cups/raster-private.h raster.h cups.h \
   ../cups/cups.h ../cups/debug-private.h ../cups/versioning.h \
   ../cups/string-private.h ../config.h
 testsnmp.o: testsnmp.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1612,13 +1582,13 @@ testsnmp.o: testsnmp.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h \
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h \
   snmp-private.h
 testthreads.o: testthreads.c ../cups/cups.h file.h versioning.h ipp.h \
   http.h array.h language.h pwg.h ../cups/thread.h
 tlscheck.o: tlscheck.c cups-private.h string-private.h ../config.h \
-  ../cups/versioning.h array-private.h ../cups/array.h versioning.h \
-  ipp-private.h ../cups/cups.h file.h ipp.h http.h array.h language.h \
+  ../cups/versioning.h debug-internal.h debug-private.h ipp-private.h \
+  ../cups/cups.h file.h versioning.h ipp.h http.h array.h language.h \
   pwg.h http-private.h ../cups/language.h ../cups/http.h \
   \
   \
@@ -1641,4 +1611,4 @@ tlscheck.o: tlscheck.c cups-private.h string-private.h ../config.h \
   \
   \
   \
-  language-private.h ../cups/transcode.h pwg-private.h thread.h
+  language-private.h ../cups/transcode.h pwg-private.h thread.h cups.h
index a9ff5075cfb8631fbac208511999f8b8b5446531..cd4d3f2a7ac26f59aed707c16ea7a6448e914efe 100644 (file)
@@ -147,7 +147,6 @@ HEADERS             =       \
                $(LIBHEADERS)
 
 COREHEADERSPRIV =      \
-               array-private.h \
                cups-private.h \
                debug-private.h \
                file-private.h \
diff --git a/cups/array-private.h b/cups/array-private.h
deleted file mode 100644 (file)
index e4d7b8a..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Private array definitions for CUPS.
- *
- * Copyright 2011-2012 by Apple Inc.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
- */
-
-#ifndef _CUPS_ARRAY_PRIVATE_H_
-#  define _CUPS_ARRAY_PRIVATE_H_
-
-/*
- * Include necessary headers...
- */
-
-#  include <cups/array.h>
-
-
-/*
- * C++ magic...
- */
-
-#  ifdef __cplusplus
-extern "C" {
-#  endif /* __cplusplus */
-
-
-/*
- * Functions...
- */
-
-extern int             _cupsArrayAddStrings(cups_array_t *a, const char *s,
-                                            char delim) _CUPS_PRIVATE;
-extern cups_array_t    *_cupsArrayNewStrings(const char *s, char delim)
-                                             _CUPS_PRIVATE;
-
-#  ifdef __cplusplus
-}
-#  endif /* __cplusplus */
-#endif /* !_CUPS_ARRAY_PRIVATE_H_ */
index c590ed4f591b6b1c6de4298b4945dddb7dcbfea8..f3bf8ffd4b5d0e124804071cc97d94e24867bf1d 100644 (file)
-/*
- * Sorted array routines for CUPS.
- *
- * Copyright 2007-2014 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Sorted array routines for CUPS.
+//
+// Copyright Â© 2023 by OpenPrinting.
+// Copyright Â©Â 2007-2014 by Apple Inc.
+// Copyright Â©Â 1997-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0.  See the file "LICENSE" for more
+// information.
+//
 
 #include <cups/cups.h>
 #include "string-private.h"
 #include "debug-internal.h"
-#include "array-private.h"
 
 
-/*
- * Limits...
- */
+//
+// Limits...
+//
 
-#define _CUPS_MAXSAVE  32              /**** Maximum number of saves ****/
+#define _CUPS_MAXSAVE  32              // Maximum number of saves
 
 
-/*
- * Types and structures...
- */
+//
+// Types and structures...
+//
 
-struct _cups_array_s                   /**** CUPS array structure ****/
+struct _cups_array_s                   // CUPS array structure
 {
- /*
-  * The current implementation uses an insertion sort into an array of
-  * sorted pointers.  We leave the array type private/opaque so that we
-  * can change the underlying implementation without affecting the users
-  * of this API.
-  */
-
-  int                  num_elements,   /* Number of array elements */
-                       alloc_elements, /* Allocated array elements */
-                       current,        /* Current element */
-                       insert,         /* Last inserted element */
-                       unique,         /* Are all elements unique? */
-                       num_saved,      /* Number of saved elements */
+  // The current implementation uses an insertion sort into an array of
+  // sorted pointers.  We leave the array type private/opaque so that we
+  // can change the underlying implementation without affecting the users
+  // of this API.
+  int                  num_elements,   // Number of array elements
+                       alloc_elements, // Allocated array elements
+                       current,        // Current element
+                       insert,         // Last inserted element
+                       unique,         // Are all elements unique?
+                       num_saved,      // Number of saved elements
                        saved[_CUPS_MAXSAVE];
-                                       /* Saved elements */
-  void                 **elements;     /* Array elements */
-  cups_array_func_t    compare;        /* Element comparison function */
-  void                 *data;          /* User data passed to compare */
-  cups_ahash_func_t    hashfunc;       /* Hash function */
-  int                  hashsize,       /* Size of hash */
-                       *hash;          /* Hash array */
-  cups_acopy_func_t    copyfunc;       /* Copy function */
-  cups_afree_func_t    freefunc;       /* Free function */
+                                       // Saved elements
+  void                 **elements;     // Array elements
+  cups_array_cb_t      compare;        // Element comparison function
+  void                 *data;          // User data passed to compare
+  cups_ahash_cb_t      hashfunc;       // Hash function
+  int                  hashsize,       // Size of hash
+                       *hash;          // Hash array
+  cups_acopy_cb_t      copyfunc;       // Copy function
+  cups_afree_cb_t      freefunc;       // Free function
 };
 
 
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
 
 static int     cups_array_add(cups_array_t *a, void *e, int insert);
 static int     cups_array_find(cups_array_t *a, void *e, int prev, int *rdiff);
 
 
-/*
- * 'cupsArrayAdd()' - Add an element to the array.
- *
- * When adding an element to a sorted array, non-unique elements are
- * appended at the end of the run of identical elements.  For unsorted arrays,
- * the element is appended to the end of the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayAdd()' - Add an element to the array.
+//
+// When adding an element to a sorted array, non-unique elements are
+// appended at the end of the run of identical elements.  For unsorted arrays,
+// the element is appended to the end of the array.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
 
-int                                    /* O - 1 on success, 0 on failure */
-cupsArrayAdd(cups_array_t *a,          /* I - Array */
-             void         *e)          /* I - Element */
+int                                    // O - 1 on success, 0 on failure
+cupsArrayAdd(cups_array_t *a,          // I - Array
+             void         *e)          // I - Element
 {
   DEBUG_printf("2cupsArrayAdd(a=%p, e=%p)", (void *)a, e);
 
- /*
-  * Range check input...
-  */
-
+  // Range check input...
   if (!a || !e)
   {
     DEBUG_puts("3cupsArrayAdd: returning 0");
     return (0);
   }
 
- /*
-  * Append the element...
-  */
-
+  // Append the element...
   return (cups_array_add(a, e, 0));
 }
 
 
-/*
- * '_cupsArrayAddStrings()' - Add zero or more delimited strings to an array.
- *
- * Note: The array MUST be created using the @link _cupsArrayNewStrings@
- * function. Duplicate strings are NOT added. If the string pointer "s" is NULL
- * or the empty string, no strings are added to the array.
- */
-
-int                                    /* O - 1 on success, 0 on failure */
-_cupsArrayAddStrings(cups_array_t *a,  /* I - Array */
-                     const char   *s,  /* I - Delimited strings or NULL */
-                     char         delim)/* I - Delimiter character */
+//
+// 'cupsArrayAddStrings()' - Add zero or more delimited strings to an array.
+//
+// Note: The array MUST be created using the @link _cupsArrayNewStrings@
+// function. Duplicate strings are NOT added. If the string pointer "s" is NULL
+// or the empty string, no strings are added to the array.
+//
+// @since CUPS 2.5@
+//
+
+bool                                   // O - `true` on success, `false` on failure
+cupsArrayAddStrings(cups_array_t *a,   // I - Array
+                    const char   *s,   // I - Delimited strings or NULL
+                    char         delim)        // I - Delimiter character
 {
-  char         *buffer,                /* Copy of string */
-               *start,                 /* Start of string */
-               *end;                   /* End of string */
-  int          status = 1;             /* Status of add */
+  char         *buffer,                // Copy of string
+               *start,                 // Start of string
+               *end;                   // End of string
+  bool         status = true;          // Status of add
 
 
   DEBUG_printf("_cupsArrayAddStrings(a=%p, s=\"%s\", delim='%c')", (void *)a, s, delim);
@@ -122,15 +112,12 @@ _cupsArrayAddStrings(cups_array_t *a,     /* I - Array */
   if (!a || !s || !*s)
   {
     DEBUG_puts("1_cupsArrayAddStrings: Returning 0");
-    return (0);
+    return (false);
   }
 
   if (delim == ' ')
   {
-   /*
-    * Skip leading whitespace...
-    */
-
+    // Skip leading whitespace...
     DEBUG_puts("1_cupsArrayAddStrings: Skipping leading whitespace.");
 
     while (*s && isspace(*s & 255))
@@ -139,33 +126,25 @@ _cupsArrayAddStrings(cups_array_t *a,     /* I - Array */
     DEBUG_printf("1_cupsArrayAddStrings: Remaining string \"%s\".", s);
   }
 
-  if (!strchr(s, delim) &&
-      (delim != ' ' || (!strchr(s, '\t') && !strchr(s, '\n'))))
+  if (!strchr(s, delim) && (delim != ' ' || (!strchr(s, '\t') && !strchr(s, '\n'))))
   {
-   /*
-    * String doesn't contain a delimiter, so add it as a single value...
-    */
-
-    DEBUG_puts("1_cupsArrayAddStrings: No delimiter seen, adding a single "
-               "value.");
+    // String doesn't contain a delimiter, so add it as a single value...
+    DEBUG_puts("1_cupsArrayAddStrings: No delimiter seen, adding a single value.");
 
     if (!cupsArrayFind(a, (void *)s))
-      status = cupsArrayAdd(a, (void *)s);
+      status = cupsArrayAdd(a, (void *)s) != 0;
   }
   else if ((buffer = strdup(s)) == NULL)
   {
     DEBUG_puts("1_cupsArrayAddStrings: Unable to duplicate string.");
-    status = 0;
+    status = false;
   }
   else
   {
     for (start = end = buffer; *end; start = end)
     {
-     /*
-      * Find the end of the current delimited string and see if we need to add
-      * it...
-      */
-
+      // Find the end of the current delimited string and see if we need to add
+      // it...
       if (delim == ' ')
       {
         while (*end && !isspace(*end & 255))
@@ -174,9 +153,13 @@ _cupsArrayAddStrings(cups_array_t *a,      /* I - Array */
           *end++ = '\0';
       }
       else if ((end = strchr(start, delim)) != NULL)
+      {
         *end++ = '\0';
+      }
       else
+      {
         end = start + strlen(start);
+      }
 
       DEBUG_printf("1_cupsArrayAddStrings: Adding \"%s\", end=\"%s\"", start, end);
 
@@ -193,44 +176,35 @@ _cupsArrayAddStrings(cups_array_t *a,     /* I - Array */
 }
 
 
-/*
- * 'cupsArrayClear()' - Clear the array.
- *
- * This function is equivalent to removing all elements in the array.
- * The caller is responsible for freeing the memory used by the
- * elements themselves.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayClear()' - Clear the array.
+//
+// This function is equivalent to removing all elements in the array.
+// The caller is responsible for freeing the memory used by the
+// elements themselves.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
 
 void
-cupsArrayClear(cups_array_t *a)                /* I - Array */
+cupsArrayClear(cups_array_t *a)                // I - Array
 {
- /*
-  * Range check input...
-  */
-
+  // Range check input...
   if (!a)
     return;
 
- /*
-  * Free the existing elements as needed..
-  */
-
+  // Free the existing elements as needed..
   if (a->freefunc)
   {
-    int                i;                      /* Looping var */
-    void       **e;                    /* Current element */
+    int                i;                      // Looping var
+    void       **e;                    // Current element
 
     for (i = a->num_elements, e = a->elements; i > 0; i --, e ++)
       (a->freefunc)(*e, a->data);
   }
 
- /*
-  * Set the number of elements to 0; we don't actually free the memory
-  * here - that is done in cupsArrayDelete()...
-  */
-
+  // Set the number of elements to 0; we don't actually free the memory
+  // here - that is done in cupsArrayDelete()...
   a->num_elements = 0;
   a->current      = -1;
   a->insert       = -1;
@@ -239,97 +213,63 @@ cupsArrayClear(cups_array_t *a)           /* I - Array */
 }
 
 
-/*
- * 'cupsArrayCount()' - Get the number of elements in the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayCount()' - Get the number of elements in the array.
+//
+// @deprecated@ @exclude all@
+//
 
-int                                    /* O - Number of elements */
-cupsArrayCount(cups_array_t *a)                /* I - Array */
+int                                    // O - Number of elements
+cupsArrayCount(cups_array_t *a)                // I - Array
 {
- /*
-  * Range check input...
-  */
-
-  if (!a)
-    return (0);
-
- /*
-  * Return the number of elements...
-  */
-
-  return (a->num_elements);
+  return (cupsArrayGetCount(a));
 }
 
 
-/*
- * 'cupsArrayCurrent()' - Return the current element in the array.
- *
- * The current element is undefined until you call @link cupsArrayFind@,
- * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayCurrent()' - Return the current element in the array.
+//
+// The current element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
+//
+// @deprecated@ @exclude all@
+//
 
-void *                                 /* O - Element */
-cupsArrayCurrent(cups_array_t *a)      /* I - Array */
+void *                                 // O - Element
+cupsArrayCurrent(cups_array_t *a)      // I - Array
 {
- /*
-  * Range check input...
-  */
-
-  if (!a)
-    return (NULL);
-
- /*
-  * Return the current element...
-  */
-
-  if (a->current >= 0 && a->current < a->num_elements)
-    return (a->elements[a->current]);
-  else
-    return (NULL);
+  return (cupsArrayGetCurrent(a));
 }
 
 
-/*
- * 'cupsArrayDelete()' - Free all memory used by the array.
- *
- * The caller is responsible for freeing the memory used by the
- * elements themselves.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayDelete()' - Free all memory used by the array.
+//
+// The caller is responsible for freeing the memory used by the
+// elements themselves.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
 
 void
-cupsArrayDelete(cups_array_t *a)       /* I - Array */
+cupsArrayDelete(cups_array_t *a)       // I - Array
 {
- /*
-  * Range check input...
-  */
-
+  // Range check input...
   if (!a)
     return;
 
- /*
-  * Free the elements if we have a free function (otherwise the caller is
-  * responsible for doing the dirty work...)
-  */
-
+  // Free the elements if we have a free function (otherwise the caller is
+  // responsible for doing the dirty work...)
   if (a->freefunc)
   {
-    int                i;                      /* Looping var */
-    void       **e;                    /* Current element */
+    int                i;                      // Looping var
+    void       **e;                    // Current element
 
     for (i = a->num_elements, e = a->elements; i > 0; i --, e ++)
       (a->freefunc)(*e, a->data);
   }
 
- /*
-  * Free the array of element pointers...
-  */
-
+  // Free the array of element pointers...
   if (a->alloc_elements)
     free(a->elements);
 
@@ -340,29 +280,23 @@ cupsArrayDelete(cups_array_t *a)  /* I - Array */
 }
 
 
-/*
- * 'cupsArrayDup()' - Duplicate the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayDup()' - Duplicate the array.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
 
-cups_array_t *                         /* O - Duplicate array */
-cupsArrayDup(cups_array_t *a)          /* I - Array */
+cups_array_t *                         // O - Duplicate array
+cupsArrayDup(cups_array_t *a)          // I - Array
 {
-  cups_array_t *da;                    /* Duplicate array */
+  cups_array_t *da;                    // Duplicate array
 
 
- /*
-  * Range check input...
-  */
-
+  // Range check input...
   if (!a)
     return (NULL);
 
- /*
-  * Allocate memory for the array...
-  */
-
+  // Allocate memory for the array...
   da = calloc(1, sizeof(cups_array_t));
   if (!da)
     return (NULL);
@@ -378,10 +312,7 @@ cupsArrayDup(cups_array_t *a)              /* I - Array */
 
   if (a->num_elements)
   {
-   /*
-    * Allocate memory for the elements...
-    */
-
+    // Allocate memory for the elements...
     da->elements = malloc((size_t)a->num_elements * sizeof(void *));
     if (!da->elements)
     {
@@ -389,27 +320,18 @@ cupsArrayDup(cups_array_t *a)             /* I - Array */
       return (NULL);
     }
 
-   /*
-    * Copy the element pointers...
-    */
-
+    // Copy the element pointers...
     if (a->copyfunc)
     {
-     /*
-      * Use the copy function to make a copy of each element...
-      */
-
-      int      i;                      /* Looping var */
+      // Use the copy function to make a copy of each element...
+      int      i;                      // Looping var
 
       for (i = 0; i < a->num_elements; i ++)
        da->elements[i] = (a->copyfunc)(a->elements[i], a->data);
     }
     else
     {
-     /*
-      * Just copy raw pointers...
-      */
-
+      // Just copy raw pointers...
       memcpy(da->elements, a->elements, (size_t)a->num_elements * sizeof(void *));
     }
 
@@ -417,47 +339,35 @@ cupsArrayDup(cups_array_t *a)             /* I - Array */
     da->alloc_elements = a->num_elements;
   }
 
- /*
-  * Return the new array...
-  */
-
+  // Return the new array...
   return (da);
 }
 
 
-/*
- * 'cupsArrayFind()' - Find an element in the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayFind()' - Find an element in the array.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
 
-void *                                 /* O - Element found or @code NULL@ */
-cupsArrayFind(cups_array_t *a,         /* I - Array */
-              void         *e)         /* I - Element */
+void *                                 // O - Element found or `NULL`
+cupsArrayFind(cups_array_t *a,         // I - Array
+              void         *e)         // I - Element
 {
-  int  current,                        /* Current element */
-       diff,                           /* Difference */
-       hash;                           /* Hash index */
-
+  int  current,                        // Current element
+       diff,                           // Difference
+       hash;                           // Hash index
 
- /*
-  * Range check input...
-  */
 
+  // Range check input...
   if (!a || !e)
     return (NULL);
 
- /*
-  * See if we have any elements...
-  */
-
+  // See if we have any elements...
   if (!a->num_elements)
     return (NULL);
 
- /*
-  * Yes, look for a match...
-  */
-
+  // Yes, look for a match...
   if (a->hash)
   {
     hash = (*(a->hashfunc))(e, a->data);
@@ -484,19 +394,12 @@ cupsArrayFind(cups_array_t *a,            /* I - Array */
   current = cups_array_find(a, e, current, &diff);
   if (!diff)
   {
-   /*
-    * Found a match!  If the array does not contain unique values, find
-    * the first element that is the same...
-    */
-
+    // Found a match!  If the array does not contain unique values, find
+    // the first element that is the same...
     if (!a->unique && a->compare)
     {
-     /*
-      * The array is not unique, find the first match...
-      */
-
-      while (current > 0 && !(*(a->compare))(e, a->elements[current - 1],
-                                             a->data))
+      // The array is not unique, find the first match...
+      while (current > 0 && !(*(a->compare))(e, a->elements[current - 1], a->data))
         current --;
     }
 
@@ -509,10 +412,7 @@ cupsArrayFind(cups_array_t *a,             /* I - Array */
   }
   else
   {
-   /*
-    * No match...
-    */
-
+    // No match...
     a->current = -1;
 
     return (NULL);
@@ -520,43 +420,111 @@ cupsArrayFind(cups_array_t *a,           /* I - Array */
 }
 
 
-/*
- * 'cupsArrayFirst()' - Get the first element in the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayFirst()' - Get the first element in the array.
+//
+// @deprecated@ @exclude all@
+//
 
-void *                                 /* O - First element or @code NULL@ if the array is empty */
-cupsArrayFirst(cups_array_t *a)                /* I - Array */
+void *                                 // O - First element or `NULL` if the array is empty
+cupsArrayFirst(cups_array_t *a)                // I - Array
 {
- /*
-  * Range check input...
-  */
+  return (cupsArrayGetFirst(a));
+}
+
+
+//
+// 'cupsArrayGetCount()' - Get the number of elements in the array.
+//
+// @since CUPS 2.5@
+//
+
+int                                    // O - Number of elements
+cupsArrayGetCount(cups_array_t *a)     // I - Array
+{
+  // Range check input...
+  if (!a)
+    return (0);
+
+  // Return the number of elements...
+  return (a->num_elements);
+}
+
 
+//
+// 'cupsArrayGetCurrent()' - Return the current element in the array.
+//
+// The current element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
+//
+// @since CUPS 2.5@
+//
+
+void *                                 // O - Element
+cupsArrayGetCurrent(cups_array_t *a)   // I - Array
+{
+  // Range check input...
   if (!a)
     return (NULL);
 
- /*
-  * Return the first element...
-  */
+  // Return the current element...
+  if (a->current >= 0 && a->current < a->num_elements)
+    return (a->elements[a->current]);
+  else
+    return (NULL);
+}
 
+
+//
+// 'cupsArrayGetElement()' - Get the N-th element in the array.
+//
+// @since CUPS 2.5@
+//
+
+void *                                 // O - N-th element or `NULL`
+cupsArrayGetElement(cups_array_t *a,   // I - Array
+                    int          n)    // I - Index into array, starting at 0
+{
+  if (!a)
+    return (NULL);
+
+  a->current = n;
+
+  return (cupsArrayGetCurrent(a));
+}
+
+
+//
+// 'cupsArrayGetFirst()' - Get the first element in the array.
+//
+// @since CUPS 2.5@
+//
+
+void *                                 // O - First element or `NULL` if the array is empty
+cupsArrayGetFirst(cups_array_t *a)     // I - Array
+{
+  // Range check input...
+  if (!a)
+    return (NULL);
+
+  // Return the first element...
   a->current = 0;
 
   return (cupsArrayCurrent(a));
 }
 
 
-/*
- * 'cupsArrayGetIndex()' - Get the index of the current element.
- *
- * The current element is undefined until you call @link cupsArrayFind@,
- * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
- *
- * @since CUPS 1.3/macOS 10.5@
- */
+//
+// 'cupsArrayGetIndex()' - Get the index of the current element.
+//
+// The current element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
+//
+// @since CUPS 1.3/macOS 10.5@
+//
 
-int                                    /* O - Index of the current element, starting at 0 */
-cupsArrayGetIndex(cups_array_t *a)     /* I - Array */
+int                                    // O - Index of the current element, starting at 0
+cupsArrayGetIndex(cups_array_t *a)     // I - Array
 {
   if (!a)
     return (-1);
@@ -565,14 +533,14 @@ cupsArrayGetIndex(cups_array_t *a)        /* I - Array */
 }
 
 
-/*
- * 'cupsArrayGetInsert()' - Get the index of the last inserted element.
- *
- * @since CUPS 1.3/macOS 10.5@
- */
+//
+// 'cupsArrayGetInsert()' - Get the index of the last inserted element.
+//
+// @since CUPS 1.3/macOS 10.5@
+//
 
-int                                    /* O - Index of the last inserted element, starting at 0 */
-cupsArrayGetInsert(cups_array_t *a)    /* I - Array */
+int                                    // O - Index of the last inserted element, starting at 0
+cupsArrayGetInsert(cups_array_t *a)    // I - Array
 {
   if (!a)
     return (-1);
@@ -581,163 +549,233 @@ cupsArrayGetInsert(cups_array_t *a)     /* I - Array */
 }
 
 
-/*
- * 'cupsArrayIndex()' - Get the N-th element in the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayGetLast()' - Get the last element in the array.
+//
+// @since CUPS 2.5@
+//
 
-void *                                 /* O - N-th element or @code NULL@ */
-cupsArrayIndex(cups_array_t *a,                /* I - Array */
-               int          n)         /* I - Index into array, starting at 0 */
+void *                                 // O - Last element or `NULL` if the array is empty
+cupsArrayGetLast(cups_array_t *a)      // I - Array
 {
+  // Range check input...
   if (!a)
     return (NULL);
 
-  a->current = n;
+  // Return the last element...
+  a->current = a->num_elements - 1;
 
   return (cupsArrayCurrent(a));
 }
 
 
-/*
- * 'cupsArrayInsert()' - Insert an element in the array.
- *
- * When inserting an element in a sorted array, non-unique elements are
- * inserted at the beginning of the run of identical elements.  For unsorted
- * arrays, the element is inserted at the beginning of the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
-
-int                                    /* O - 0 on failure, 1 on success */
-cupsArrayInsert(cups_array_t *a,       /* I - Array */
-               void         *e)        /* I - Element */
+//
+// 'cupsArrayGetNext()' - Get the next element in the array.
+//
+// This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) + 1)".
+//
+// The next element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+// to set the current element.
+//
+// @since CUPS 2.5@
+//
+
+void *                                 // O - Next element or `NULL`
+cupsArrayGetNext(cups_array_t *a)      // I - Array
 {
-  DEBUG_printf("2cupsArrayInsert(a=%p, e=%p)", (void *)a, e);
-
  /*
   * Range check input...
   */
 
-  if (!a || !e)
-  {
-    DEBUG_puts("3cupsArrayInsert: returning 0");
-    return (0);
-  }
+  if (!a)
+    return (NULL);
 
  /*
-  * Insert the element...
+  * Return the next element...
   */
 
-  return (cups_array_add(a, e, 1));
-}
+  if (a->current < a->num_elements)
+    a->current ++;
 
+  return (cupsArrayCurrent(a));
+}
 
-/*
- * 'cupsArrayLast()' - Get the last element in the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
 
-void *                                 /* O - Last element or @code NULL@ if the array is empty */
-cupsArrayLast(cups_array_t *a)         /* I - Array */
+//
+// 'cupsArrayGetPrev()' - Get the previous element in the array.
+//
+// This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) - 1)".
+//
+// The previous element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+// to set the current element.
+//
+// @since CUPS 2.5@
+//
+
+void *                                 // O - Previous element or `NULL`
+cupsArrayGetPrev(cups_array_t *a)      // I - Array
 {
- /*
-  * Range check input...
-  */
-
+  // Range check input...
   if (!a)
     return (NULL);
 
- /*
-  * Return the last element...
-  */
-
-  a->current = a->num_elements - 1;
+  // Return the previous element...
+  if (a->current >= 0)
+    a->current --;
 
   return (cupsArrayCurrent(a));
 }
 
 
-/*
- * 'cupsArrayNew()' - Create a new array.
- *
- * The comparison function ("f") is used to create a sorted array. The function
- * receives pointers to two elements and the user data pointer ("d") - the user
- * data pointer argument can safely be omitted when not required so functions
- * like @code strcmp@ can be used for sorted string arrays.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
-
-cups_array_t *                         /* O - Array */
-cupsArrayNew(cups_array_func_t f,      /* I - Comparison function or @code NULL@ for an unsorted array */
-             void              *d)     /* I - User data pointer or @code NULL@ */
+//
+// 'cupsArrayGetUserData()' - Return the user data for an array.
+//
+// @since CUPS 2.5@
+//
+
+void *                                 // O - User data
+cupsArrayGetUserData(cups_array_t *a)  // I - Array
+{
+  if (a)
+    return (a->data);
+  else
+    return (NULL);
+}
+
+
+//
+// 'cupsArrayIndex()' - Get the N-th element in the array.
+//
+// @deprecated@ @exclude all@
+//
+
+void *                                 // O - N-th element or `NULL`
+cupsArrayIndex(cups_array_t *a,                // I - Array
+               int          n)         // I - Index into array, starting at 0
+{
+  return (cupsArrayGetElement(a, n));
+}
+
+
+//
+// 'cupsArrayInsert()' - Insert an element in the array.
+//
+// When inserting an element in a sorted array, non-unique elements are
+// inserted at the beginning of the run of identical elements.  For unsorted
+// arrays, the element is inserted at the beginning of the array.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
+
+int                                    // O - 0 on failure, 1 on success
+cupsArrayInsert(cups_array_t *a,       // I - Array
+               void         *e)        // I - Element
+{
+  DEBUG_printf("2cupsArrayInsert(a=%p, e=%p)", (void *)a, e);
+
+  // Range check input...
+  if (!a || !e)
+  {
+    DEBUG_puts("3cupsArrayInsert: returning 0");
+    return (0);
+  }
+
+  // Insert the element...
+  return (cups_array_add(a, e, 1));
+}
+
+
+//
+// 'cupsArrayLast()' - Get the last element in the array.
+//
+// @deprecated@ @exclude all@
+//
+
+void *                                 // O - Last element or `NULL` if the array is empty
+cupsArrayLast(cups_array_t *a)         // I - Array
+{
+  return (cupsArrayGetLast(a));
+}
+
+
+//
+// 'cupsArrayNew()' - Create a new array.
+//
+// The comparison function ("f") is used to create a sorted array. The function
+// receives pointers to two elements and the user data pointer ("d") - the user
+// data pointer argument can safely be omitted when not required so functions
+// like @code strcmp@ can be used for sorted string arrays.
+//
+// @deprecated@ @exclude all@
+//
+
+cups_array_t *                         // O - Array
+cupsArrayNew(cups_array_cb_t f,                // I - Comparison function or `NULL` for an unsorted array
+             void            *d)       // I - User data pointer or `NULL`
 {
   return (cupsArrayNew3(f, d, 0, 0, 0, 0));
 }
 
 
-/*
- * 'cupsArrayNew2()' - Create a new array with hash.
- *
- * The comparison function ("f") is used to create a sorted array. The function
- * receives pointers to two elements and the user data pointer ("d") - the user
- * data pointer argument can safely be omitted when not required so functions
- * like @code strcmp@ can be used for sorted string arrays.
- *
- * The hash function ("h") is used to implement cached lookups with the
- * specified hash size ("hsize").
- *
- * @since CUPS 1.3/macOS 10.5@
- */
-
-cups_array_t *                         /* O - Array */
-cupsArrayNew2(cups_array_func_t  f,    /* I - Comparison function or @code NULL@ for an unsorted array */
-              void               *d,   /* I - User data or @code NULL@ */
-              cups_ahash_func_t  h,    /* I - Hash function or @code NULL@ for unhashed lookups */
-             int                hsize) /* I - Hash size (>= 0) */
+//
+// 'cupsArrayNew2()' - Create a new array with hash.
+//
+// The comparison function ("f") is used to create a sorted array. The function
+// receives pointers to two elements and the user data pointer ("d") - the user
+// data pointer argument can safely be omitted when not required so functions
+// like @code strcmp@ can be used for sorted string arrays.
+//
+// The hash function ("h") is used to implement cached lookups with the
+// specified hash size ("hsize").
+//
+// @deprecated@ @exclude all@
+//
+
+cups_array_t *                         // O - Array
+cupsArrayNew2(cups_array_cb_t  f,      // I - Comparison function or `NULL` for an unsorted array
+              void             *d,     // I - User data or `NULL`
+              cups_ahash_cb_t  h,      // I - Hash function or `NULL` for unhashed lookups
+             int              hsize)   // I - Hash size (>= 0)
 {
   return (cupsArrayNew3(f, d, h, hsize, 0, 0));
 }
 
 
-/*
- * 'cupsArrayNew3()' - Create a new array with hash and/or free function.
- *
- * The comparison function ("f") is used to create a sorted array. The function
- * receives pointers to two elements and the user data pointer ("d") - the user
- * data pointer argument can safely be omitted when not required so functions
- * like @code strcmp@ can be used for sorted string arrays.
- *
- * The hash function ("h") is used to implement cached lookups with the
- * specified hash size ("hsize").
- *
- * The copy function ("cf") is used to automatically copy/retain elements when
- * added or the array is copied.
- *
- * The free function ("cf") is used to automatically free/release elements when
- * removed or the array is deleted.
- *
- * @since CUPS 1.5/macOS 10.7@
- */
-
-cups_array_t *                         /* O - Array */
-cupsArrayNew3(cups_array_func_t  f,    /* I - Comparison function or @code NULL@ for an unsorted array */
-              void               *d,   /* I - User data or @code NULL@ */
-              cups_ahash_func_t  h,    /* I - Hash function or @code NULL@ for unhashed lookups */
-             int                hsize, /* I - Hash size (>= 0) */
-             cups_acopy_func_t  cf,    /* I - Copy function */
-             cups_afree_func_t  ff)    /* I - Free function */
+//
+// 'cupsArrayNew3()' - Create a new array with optional compare, hash, copy, and/or free callbacks.
+//
+// This function creates a new array with optional compare, hash, copy, and free
+// callbacks.  The comparison callback ("f") is used to create a sorted array.
+// The callback receives pointers to two elements and the user data pointer
+// ("d").
+//
+// The hash callback ("h") is used to implement cached lookups with the
+// specified hash size ("hsize").
+//
+// The copy callback ("cf") is used to automatically copy/retain elements when
+// added or the array is duplicated with @link cupsArrayDup@.
+//
+// The free callback ("cf") is used to automatically free/release elements when
+// removed with @link cupsArrayRemove@ or the array is deleted with
+// @link cupsArrayDelete@.
+//
+// @since CUPS 1.5/macOS 10.7@
+//
+
+cups_array_t *                         // O - Array
+cupsArrayNew3(cups_array_cb_t  f,      // I - Comparison callback or `NULL` for an unsorted array
+              void             *d,     // I - User data or `NULL`
+              cups_ahash_cb_t  h,      // I - Hash callback or `NULL` for unhashed lookups
+             int              hsize,   // I - Hash size (>= 0)
+             cups_acopy_cb_t  cf,      // I - Copy callback
+             cups_afree_cb_t  ff)      // I - Free callback
 {
-  cups_array_t *a;                     /* Array  */
+  cups_array_t *a;                     // Array
 
 
- /*
-  * Allocate memory for the array...
-  */
-
+  // Allocate memory for the array...
   a = calloc(1, sizeof(cups_array_t));
   if (!a)
     return (NULL);
@@ -771,128 +809,95 @@ cupsArrayNew3(cups_array_func_t  f,      /* I - Comparison function or @code NULL@ fo
 }
 
 
-/*
- * '_cupsArrayNewStrings()' - Create a new array of comma-delimited strings.
- *
- * Note: The array automatically manages copies of the strings passed. If the
- * string pointer "s" is NULL or the empty string, no strings are added to the
- * newly created array.
- */
-
-cups_array_t *                         /* O - Array */
-_cupsArrayNewStrings(const char *s,    /* I - Delimited strings or NULL */
-                     char       delim) /* I - Delimiter character */
+//
+// 'cupsArrayNewStrings()' - Create a new array of delimited strings.
+//
+// This function creates a new array of strings that are delimited by the
+// specified character.  The array automatically manages copies of the strings
+// passed.  If the string pointer "s" is `NULL` or the empty string, no strings
+// are added to the newly created array.
+//
+// @since CUPS 2.5@
+//
+
+cups_array_t *                         // O - Array
+cupsArrayNewStrings(const char *s,     // I - Delimited strings or `NULL`
+                    char       delim)  // I - Delimiter character
 {
-  cups_array_t *a;                     /* Array */
+  cups_array_t *a;                     // Array
 
 
-  if ((a = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0,
-                         (cups_acopy_func_t)_cupsStrAlloc,
-                        (cups_afree_func_t)_cupsStrFree)) != NULL)
-    _cupsArrayAddStrings(a, s, delim);
+  if ((a = cupsArrayNew3((cups_array_cb_t)strcmp, NULL, NULL, 0, (cups_acopy_cb_t)_cupsStrAlloc, (cups_afree_cb_t)_cupsStrFree)) != NULL)
+    cupsArrayAddStrings(a, s, delim);
 
   return (a);
 }
 
 
-/*
- * 'cupsArrayNext()' - Get the next element in the array.
- *
- * This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) + 1)".
- *
- * The next element is undefined until you call @link cupsArrayFind@,
- * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
- * to set the current element.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
-
-void *                                 /* O - Next element or @code NULL@ */
-cupsArrayNext(cups_array_t *a)         /* I - Array */
+//
+// 'cupsArrayNext()' - Get the next element in the array.
+//
+// This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) + 1)".
+//
+// The next element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+// to set the current element.
+//
+// @deprecated@ @exclude all@
+//
+
+void *                                 // O - Next element or `NULL`
+cupsArrayNext(cups_array_t *a)         // I - Array
 {
- /*
-  * Range check input...
-  */
-
-  if (!a)
-    return (NULL);
-
- /*
-  * Return the next element...
-  */
-
-  if (a->current < a->num_elements)
-    a->current ++;
-
-  return (cupsArrayCurrent(a));
+  return (cupsArrayGetNext(a));
 }
 
 
-/*
- * 'cupsArrayPrev()' - Get the previous element in the array.
- *
- * This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) - 1)".
- *
- * The previous element is undefined until you call @link cupsArrayFind@,
- * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
- * to set the current element.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
-
-void *                                 /* O - Previous element or @code NULL@ */
-cupsArrayPrev(cups_array_t *a)         /* I - Array */
+//
+// 'cupsArrayPrev()' - Get the previous element in the array.
+//
+// This function is equivalent to "cupsArrayIndex(a, cupsArrayGetIndex(a) - 1)".
+//
+// The previous element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+// to set the current element.
+//
+// @deprecated@ @exclude all@
+//
+
+void *                                 // O - Previous element or `NULL`
+cupsArrayPrev(cups_array_t *a)         // I - Array
 {
- /*
-  * Range check input...
-  */
-
-  if (!a)
-    return (NULL);
-
- /*
-  * Return the previous element...
-  */
-
-  if (a->current >= 0)
-    a->current --;
-
-  return (cupsArrayCurrent(a));
+  return (cupsArrayGetPrev(a));
 }
 
 
-/*
- * 'cupsArrayRemove()' - Remove an element from the array.
- *
- * If more than one element matches "e", only the first matching element is
- * removed.
- *
- * The caller is responsible for freeing the memory used by the
- * removed element.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
-
-int                                    /* O - 1 on success, 0 on failure */
-cupsArrayRemove(cups_array_t *a,       /* I - Array */
-                void         *e)       /* I - Element */
+//
+// 'cupsArrayRemove()' - Remove an element from the array.
+//
+// If more than one element matches "e", only the first matching element is
+// removed.
+//
+// The caller is responsible for freeing the memory used by the
+// removed element.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
+
+int                                    // O - 1 on success, 0 on failure
+cupsArrayRemove(cups_array_t *a,       // I - Array
+                void         *e)       // I - Element
 {
-  ssize_t      i,                      /* Looping var */
-               current;                /* Current element */
-  int          diff;                   /* Difference */
+  ssize_t      i,                      // Looping var
+               current;                // Current element
+  int          diff;                   // Difference
 
 
- /*
-  * Range check input...
-  */
-
+  // Range check input...
   if (!a || !e)
     return (0);
 
- /*
-  * See if the element is in the array...
-  */
-
+  // See if the element is in the array...
   if (!a->num_elements)
     return (0);
 
@@ -900,18 +905,14 @@ cupsArrayRemove(cups_array_t *a,  /* I - Array */
   if (diff)
     return (0);
 
- /*
-  * Yes, now remove it...
-  */
-
+  // Yes, now remove it...
   a->num_elements --;
 
   if (a->freefunc)
     (a->freefunc)(a->elements[current], a->data);
 
   if (current < a->num_elements)
-    memmove(a->elements + current, a->elements + current + 1,
-            (size_t)(a->num_elements - current) * sizeof(void *));
+    memmove(a->elements + current, a->elements + current + 1, (size_t)(a->num_elements - current) * sizeof(void *));
 
   if (current <= a->current)
     a->current --;
@@ -922,8 +923,10 @@ cupsArrayRemove(cups_array_t *a,   /* I - Array */
     a->insert = -1;
 
   for (i = 0; i < a->num_saved; i ++)
+  {
     if (current <= a->saved[i])
       a->saved[i] --;
+  }
 
   if (a->num_elements <= 1)
     a->unique = 1;
@@ -932,14 +935,14 @@ cupsArrayRemove(cups_array_t *a,  /* I - Array */
 }
 
 
-/*
- * 'cupsArrayRestore()' - Reset the current element to the last @link cupsArraySave@.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayRestore()' - Reset the current element to the last @link cupsArraySave@.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
 
-void *                                 /* O - New current element */
-cupsArrayRestore(cups_array_t *a)      /* I - Array */
+void *                                 // O - New current element
+cupsArrayRestore(cups_array_t *a)      // I - Array
 {
   if (!a)
     return (NULL);
@@ -957,20 +960,20 @@ cupsArrayRestore(cups_array_t *a) /* I - Array */
 }
 
 
-/*
- * 'cupsArraySave()' - Mark the current element for a later @link cupsArrayRestore@.
- *
- * The current element is undefined until you call @link cupsArrayFind@,
- * @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
- * to set the current element.
- *
- * The save/restore stack is guaranteed to be at least 32 elements deep.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
-
-int                                    /* O - 1 on success, 0 on failure */
-cupsArraySave(cups_array_t *a)         /* I - Array */
+//
+// 'cupsArraySave()' - Mark the current element for a later @link cupsArrayRestore@.
+//
+// The current element is undefined until you call @link cupsArrayFind@,
+// @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
+// to set the current element.
+//
+// The save/restore stack is guaranteed to be at least 32 elements deep.
+//
+// @since CUPS 1.2/macOS 10.5@
+//
+
+int                                    // O - 1 on success, 0 on failure
+cupsArraySave(cups_array_t *a)         // I - Array
 {
   if (!a)
     return (0);
@@ -985,54 +988,43 @@ cupsArraySave(cups_array_t *a)            /* I - Array */
 }
 
 
-/*
- * 'cupsArrayUserData()' - Return the user data for an array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cupsArrayUserData()' - Return the user data for an array.
+//
+// @deprecated@ @exclude all@
+//
 
-void *                                 /* O - User data */
-cupsArrayUserData(cups_array_t *a)     /* I - Array */
+void *                                 // O - User data
+cupsArrayUserData(cups_array_t *a)     // I - Array
 {
-  if (a)
-    return (a->data);
-  else
-    return (NULL);
+  return (cupsArrayGetUserData(a));
 }
 
 
-/*
- * 'cups_array_add()' - Insert or append an element to the array.
- *
- * @since CUPS 1.2/macOS 10.5@
- */
+//
+// 'cups_array_add()' - Insert or append an element to the array.
+//
 
-static int                             /* O - 1 on success, 0 on failure */
-cups_array_add(cups_array_t *a,                /* I - Array */
-               void         *e,                /* I - Element to add */
-              int          insert)     /* I - 1 = insert, 0 = append */
+static int                             // O - 1 on success, 0 on failure
+cups_array_add(cups_array_t *a,                // I - Array
+               void         *e,                // I - Element to add
+              int          insert)     // I - 1 = insert, 0 = append
 {
-  int          i,                      /* Looping var */
-               current;                /* Current element */
-  int          diff;                   /* Comparison with current element */
+  int          i,                      // Looping var
+               current;                // Current element
+  int          diff;                   // Comparison with current element
 
 
   DEBUG_printf("7cups_array_add(a=%p, e=%p, insert=%d)", (void *)a, e, insert);
 
- /*
-  * Verify we have room for the new element...
-  */
-
+  // Verify we have room for the new element...
   if (a->num_elements >= a->alloc_elements)
   {
-   /*
-    * Allocate additional elements; start with 16 elements, then
-    * double the size until 1024 elements, then add 1024 elements
-    * thereafter...
-    */
-
-    void       **temp;                 /* New array elements */
-    int                count;                  /* New allocation count */
+    // Allocate additional elements; start with 16 elements, then
+    // double the size until 1024 elements, then add 1024 elements
+    // thereafter...
+    void       **temp;                 // New array elements
+    int                count;                  // New allocation count
 
 
     if (a->alloc_elements == 0)
@@ -1062,99 +1054,73 @@ cups_array_add(cups_array_t *a,         /* I - Array */
     a->elements       = temp;
   }
 
- /*
-  * Find the insertion point for the new element; if there is no
-  * compare function or elements, just add it to the beginning or end...
-  */
-
+  // Find the insertion point for the new element; if there is no
+  // compare function or elements, just add it to the beginning or end...
   if (!a->num_elements || !a->compare)
   {
-   /*
-    * No elements or comparison function, insert/append as needed...
-    */
-
+    // No elements or comparison function, insert/append as needed...
     if (insert)
-      current = 0;                     /* Insert at beginning */
+      current = 0;                     // Insert at beginning
     else
-      current = a->num_elements;       /* Append to the end */
+      current = a->num_elements;       // Append to the end
   }
   else
   {
-   /*
-    * Do a binary search for the insertion point...
-    */
-
+    // Do a binary search for the insertion point...
     current = cups_array_find(a, e, a->insert, &diff);
 
     if (diff > 0)
     {
-     /*
-      * Insert after the current element...
-      */
-
+      // Insert after the current element...
       current ++;
     }
     else if (!diff)
     {
-     /*
-      * Compared equal, make sure we add to the beginning or end of
-      * the current run of equal elements...
-      */
-
+      // Compared equal, make sure we add to the beginning or end of
+      // the current run of equal elements...
       a->unique = 0;
 
       if (insert)
       {
-       /*
-        * Insert at beginning of run...
-       */
-
-       while (current > 0 && !(*(a->compare))(e, a->elements[current - 1],
-                                               a->data))
+        // Insert at beginning of run...
+       while (current > 0 && !(*(a->compare))(e, a->elements[current - 1], a->data))
           current --;
       }
       else
       {
-       /*
-        * Append at end of run...
-       */
-
+        // Append at end of run...
        do
        {
           current ++;
        }
-       while (current < a->num_elements &&
-               !(*(a->compare))(e, a->elements[current], a->data));
+       while (current < a->num_elements && !(*(a->compare))(e, a->elements[current], a->data));
       }
     }
   }
 
- /*
-  * Insert or append the element...
-  */
-
+  // Insert or append the element...
   if (current < a->num_elements)
   {
-   /*
-    * Shift other elements to the right...
-    */
-
-    memmove(a->elements + current + 1, a->elements + current,
-            (size_t)(a->num_elements - current) * sizeof(void *));
+    // Shift other elements to the right...
+    memmove(a->elements + current + 1, a->elements + current, (size_t)(a->num_elements - current) * sizeof(void *));
 
     if (a->current >= current)
       a->current ++;
 
     for (i = 0; i < a->num_saved; i ++)
+    {
       if (a->saved[i] >= current)
        a->saved[i] ++;
+    }
 
     DEBUG_printf("9cups_array_add: insert element at index " CUPS_LLFMT, CUPS_LLCAST current);
   }
 #ifdef DEBUG
   else
+  {
     DEBUG_printf("9cups_array_add: append element at " CUPS_LLFMT, CUPS_LLCAST current);
-#endif /* DEBUG */
+  }
+#endif // DEBUG
 
   if (a->copyfunc)
   {
@@ -1165,7 +1131,9 @@ cups_array_add(cups_array_t *a,           /* I - Array */
     }
   }
   else
+  {
     a->elements[current] = e;
+  }
 
   a->num_elements ++;
   a->insert = current;
@@ -1173,7 +1141,7 @@ cups_array_add(cups_array_t *a,           /* I - Array */
 #ifdef DEBUG
   for (current = 0; current < a->num_elements; current ++)
     DEBUG_printf("9cups_array_add: a->elements[" CUPS_LLFMT "]=%p", CUPS_LLCAST current, a->elements[current]);
-#endif /* DEBUG */
+#endif // DEBUG
 
   DEBUG_puts("9cups_array_add: returning 1");
 
@@ -1181,46 +1149,35 @@ cups_array_add(cups_array_t *a,         /* I - Array */
 }
 
 
-/*
- * 'cups_array_find()' - Find an element in the array.
- */
+//
+// 'cups_array_find()' - Find an element in the array.
+//
 
-static int                             /* O - Index of match */
-cups_array_find(cups_array_t *a,       /* I - Array */
-               void         *e,        /* I - Element */
-               int          prev,      /* I - Previous index */
-               int          *rdiff)    /* O - Difference of match */
+static int                             // O - Index of match
+cups_array_find(cups_array_t *a,       // I - Array
+               void         *e,        // I - Element
+               int          prev,      // I - Previous index
+               int          *rdiff)    // O - Difference of match
 {
-  int  left,                           /* Left side of search */
-       right,                          /* Right side of search */
-       current,                        /* Current element */
-       diff;                           /* Comparison with current element */
+  int  left,                           // Left side of search
+       right,                          // Right side of search
+       current,                        // Current element
+       diff;                           // Comparison with current element
 
 
   DEBUG_printf("7cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)", (void *)a, e, prev, (void *)rdiff);
 
   if (a->compare)
   {
-   /*
-    * Do a binary search for the element...
-    */
-
+    // Do a binary search for the element...
     DEBUG_puts("9cups_array_find: binary search");
 
     if (prev >= 0 && prev < a->num_elements)
     {
-     /*
-      * Start search on either side of previous...
-      */
-
-      if ((diff = (*(a->compare))(e, a->elements[prev], a->data)) == 0 ||
-          (diff < 0 && prev == 0) ||
-         (diff > 0 && prev == (a->num_elements - 1)))
+      // Start search on either side of previous...
+      if ((diff = (*(a->compare))(e, a->elements[prev], a->data)) == 0 || (diff < 0 && prev == 0) || (diff > 0 && prev == (a->num_elements - 1)))
       {
-       /*
-        * Exact or edge match, return it!
-       */
-
+        // Exact or edge match, return it!
         DEBUG_printf("9cups_array_find: Returning %d, diff=%d", prev, diff);
 
        *rdiff = diff;
@@ -1229,29 +1186,20 @@ cups_array_find(cups_array_t *a,        /* I - Array */
       }
       else if (diff < 0)
       {
-       /*
-        * Start with previous on right side...
-       */
-
+        // Start with previous on right side...
        left  = 0;
        right = prev;
       }
       else
       {
-       /*
-        * Start with previous on left side...
-       */
-
+        // Start with previous on left side...
         left  = prev;
        right = a->num_elements - 1;
       }
     }
     else
     {
-     /*
-      * Start search in the middle...
-      */
-
+      // Start search in the middle...
       left  = 0;
       right = a->num_elements - 1;
     }
@@ -1274,12 +1222,11 @@ cups_array_find(cups_array_t *a,        /* I - Array */
 
     if (diff != 0)
     {
-     /*
-      * Check the last 1 or 2 elements...
-      */
-
+      // Check the last 1 or 2 elements...
       if ((diff = (*(a->compare))(e, a->elements[left], a->data)) <= 0)
+      {
         current = left;
+      }
       else
       {
         diff    = (*(a->compare))(e, a->elements[right], a->data);
@@ -1289,26 +1236,22 @@ cups_array_find(cups_array_t *a,        /* I - Array */
   }
   else
   {
-   /*
-    * Do a linear pointer search...
-    */
-
+    // Do a linear pointer search...
     DEBUG_puts("9cups_array_find: linear search");
 
     diff = 1;
 
     for (current = 0; current < a->num_elements; current ++)
+    {
       if (a->elements[current] == e)
       {
         diff = 0;
         break;
       }
+    }
   }
 
- /*
-  * Return the closest element and the difference...
-  */
-
+  // Return the closest element and the difference...
   DEBUG_printf("8cups_array_find: Returning %d, diff=%d", current, diff);
 
   *rdiff = diff;
index e5468a302060163c72059c645218949137c07766..861c578655c79f0736d3ef3ce6afe11041104a2b 100644 (file)
@@ -1,80 +1,83 @@
-/*
- * Sorted array definitions for CUPS.
- *
- * Copyright 2007-2010 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
- */
+//
+// Sorted array definitions for CUPS.
+//
+// Copyright Â© 2023 by OpenPrinting.
+// Copyright Â© 2007-2010 by Apple Inc.
+// Copyright Â©Â 1997-2007 by Easy Software Products.
+//
+// Licensed under Apache License v2.0.  See the file "LICENSE" for more
+// information.
+//
 
 #ifndef _CUPS_ARRAY_H_
 #  define _CUPS_ARRAY_H_
-
-/*
- * Include necessary headers...
- */
-
 #  include "versioning.h"
 #  include <stdlib.h>
-
-
-/*
- * C++ magic...
- */
-
 #  ifdef __cplusplus
 extern "C" {
-#  endif /* __cplusplus */
+#  endif // __cplusplus
 
 
-/*
- * Types and structures...
- */
+//
+// Types and structures...
+//
 
 typedef struct _cups_array_s cups_array_t;
-                                       /**** CUPS array type ****/
-typedef int (*cups_array_func_t)(void *first, void *second, void *data);
-                                       /**** Array comparison function ****/
-typedef int (*cups_ahash_func_t)(void *element, void *data);
-                                       /**** Array hash function ****/
-typedef void *(*cups_acopy_func_t)(void *element, void *data);
-                                       /**** Array element copy function ****/
-typedef void (*cups_afree_func_t)(void *element, void *data);
-                                       /**** Array element free function ****/
+                                       // CUPS array type
+typedef int (*cups_array_cb_t)(void *first, void *second, void *data);
+                                       // Array comparison function
+typedef int (*cups_ahash_cb_t)(void *element, void *data);
+                                       // Array hash function
+typedef void *(*cups_acopy_cb_t)(void *element, void *data);
+                                       // Array element copy function
+typedef void (*cups_afree_cb_t)(void *element, void *data);
+                                       // Array element free function
+
+// Old type names
+# define cups_array_func_t cups_array_cb_t
+# define cups_ahash_func_t cups_ahash_cb_t
+# define cups_acopy_func_t cups_acopy_cb_t
+# define cups_afree_func_t cups_afree_cb_t
 
 
-/*
- * Functions...
- */
+//
+// Functions...
+//
 
-extern int             cupsArrayAdd(cups_array_t *a, void *e) _CUPS_API_1_2;
-extern void            cupsArrayClear(cups_array_t *a) _CUPS_API_1_2;
-extern int             cupsArrayCount(cups_array_t *a) _CUPS_API_1_2;
-extern void            *cupsArrayCurrent(cups_array_t *a) _CUPS_API_1_2;
-extern void            cupsArrayDelete(cups_array_t *a) _CUPS_API_1_2;
-extern cups_array_t    *cupsArrayDup(cups_array_t *a) _CUPS_API_1_2;
-extern void            *cupsArrayFind(cups_array_t *a, void *e) _CUPS_API_1_2;
-extern void            *cupsArrayFirst(cups_array_t *a) _CUPS_API_1_2;
-extern int             cupsArrayGetIndex(cups_array_t *a) _CUPS_API_1_3;
-extern int             cupsArrayGetInsert(cups_array_t *a) _CUPS_API_1_3;
-extern void            *cupsArrayIndex(cups_array_t *a, int n) _CUPS_API_1_2;
-extern int             cupsArrayInsert(cups_array_t *a, void *e) _CUPS_API_1_2;
-extern void            *cupsArrayLast(cups_array_t *a) _CUPS_API_1_2;
-extern cups_array_t    *cupsArrayNew(cups_array_func_t f, void *d) _CUPS_API_1_2;
-extern cups_array_t    *cupsArrayNew2(cups_array_func_t f, void *d,
-                                      cups_ahash_func_t h, int hsize) _CUPS_API_1_3;
-extern cups_array_t    *cupsArrayNew3(cups_array_func_t f, void *d,
-                                      cups_ahash_func_t h, int hsize,
-                                      cups_acopy_func_t cf,
-                                      cups_afree_func_t ff) _CUPS_API_1_5;
-extern void            *cupsArrayNext(cups_array_t *a) _CUPS_API_1_2;
-extern void            *cupsArrayPrev(cups_array_t *a) _CUPS_API_1_2;
-extern int             cupsArrayRemove(cups_array_t *a, void *e) _CUPS_API_1_2;
-extern void            *cupsArrayRestore(cups_array_t *a) _CUPS_API_1_2;
-extern int             cupsArraySave(cups_array_t *a) _CUPS_API_1_2;
-extern void            *cupsArrayUserData(cups_array_t *a) _CUPS_API_1_2;
+extern int             cupsArrayAdd(cups_array_t *a, void *e) _CUPS_PUBLIC;
+extern bool            cupsArrayAddStrings(cups_array_t *a, const char *s, char delim) _CUPS_PUBLIC;
+extern void            cupsArrayClear(cups_array_t *a) _CUPS_PUBLIC;
+extern int             cupsArrayCount(cups_array_t *a) _CUPS_DEPRECATED_MSG("Use cupsArrayGetCount instead.");
+extern void            *cupsArrayCurrent(cups_array_t *a) _CUPS_DEPRECATED_MSG("Use cupsArrayGetCurrent instead.");
+extern void            cupsArrayDelete(cups_array_t *a) _CUPS_PUBLIC;
+extern cups_array_t    *cupsArrayDup(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayFind(cups_array_t *a, void *e) _CUPS_PUBLIC;
+extern void            *cupsArrayFirst(cups_array_t *a) _CUPS_DEPRECATED_MSG("Use cupsArrayGetFirst instead.");
+extern int             cupsArrayGetCount(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayGetCurrent(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayGetElement(cups_array_t *a, int n) _CUPS_PUBLIC;
+extern void            *cupsArrayGetFirst(cups_array_t *a) _CUPS_PUBLIC;
+extern int             cupsArrayGetIndex(cups_array_t *a) _CUPS_PUBLIC;
+extern int             cupsArrayGetInsert(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayGetLast(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayGetNext(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayGetPrev(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayGetUserData(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayIndex(cups_array_t *a, int n) _CUPS_PUBLIC;
+extern int             cupsArrayInsert(cups_array_t *a, void *e) _CUPS_PUBLIC;
+extern void            *cupsArrayLast(cups_array_t *a) _CUPS_DEPRECATED_MSG("Use cupsArrayGetLast instead.");
+extern cups_array_t    *cupsArrayNew(cups_array_cb_t f, void *d)_CUPS_DEPRECATED_MSG("Use cupsArrayNew3 instead.");
+extern cups_array_t    *cupsArrayNew2(cups_array_cb_t f, void *d, cups_ahash_cb_t h, int hsize) _CUPS_DEPRECATED_MSG("Use cupsArrayNew3 instead.");
+extern cups_array_t    *cupsArrayNew3(cups_array_cb_t f, void *d, cups_ahash_cb_t h, int hsize, cups_acopy_cb_t cf, cups_afree_cb_t ff) _CUPS_PUBLIC;
+extern cups_array_t    *cupsArrayNewStrings(const char *s, char delim) _CUPS_PUBLIC;
+extern void            *cupsArrayNext(cups_array_t *a) _CUPS_DEPRECATED_MSG("Use cupsArrayGetNext instead.");
+extern void            *cupsArrayPrev(cups_array_t *a) _CUPS_DEPRECATED_MSG("Use cupsArrayGetPrev instead.");
+extern int             cupsArrayRemove(cups_array_t *a, void *e) _CUPS_PUBLIC;
+extern void            *cupsArrayRestore(cups_array_t *a) _CUPS_PUBLIC;
+extern int             cupsArraySave(cups_array_t *a) _CUPS_PUBLIC;
+extern void            *cupsArrayUserData(cups_array_t *a) _CUPS_DEPRECATED_MSG("Use cupsArrayGetUserData instead.");
 
 #  ifdef __cplusplus
 }
-#  endif /* __cplusplus */
-#endif /* !_CUPS_ARRAY_H_ */
+#  endif // __cplusplus
+#endif // !_CUPS_ARRAY_H_
index 0b87d9b4c08ed9e4daeaa88eb788dbc081407db1..45e29be5efc483b15026d6292089974a45a1120d 100644 (file)
@@ -13,7 +13,6 @@
 #  define _CUPS_CUPS_PRIVATE_H_
 #  include "string-private.h"
 #  include "debug-internal.h"
-#  include "array-private.h"
 #  include "ipp-private.h"
 #  include "http-private.h"
 #  include "language-private.h"
index b6f5417d8dc8cf8e95687b38aaf6c10cb29636b8..aa581e4d105422829583ff4b53ad160a66a3a64c 100644 (file)
@@ -953,9 +953,9 @@ _ppdCacheCreateWithFile(
     else if (!_cups_strcasecmp(line, "Mandatory"))
     {
       if (pc->mandatory)
-        _cupsArrayAddStrings(pc->mandatory, value, ' ');
+        cupsArrayAddStrings(pc->mandatory, value, ' ');
       else
-        pc->mandatory = _cupsArrayNewStrings(value, ' ');
+        pc->mandatory = cupsArrayNewStrings(value, ' ');
     }
     else if (!_cups_strcasecmp(line, "SupportFile"))
     {
@@ -1985,7 +1985,7 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd)   /* I - PPD file */
     pc->password = strdup(ppd_attr->value);
 
   if ((ppd_attr = ppdFindAttr(ppd, "cupsMandatory", NULL)) != NULL)
-    pc->mandatory = _cupsArrayNewStrings(ppd_attr->value, ' ');
+    pc->mandatory = cupsArrayNewStrings(ppd_attr->value, ' ');
 
  /*
   * Support files...
index 7bead9a015b9fa0c0e0badbb64db01356d6fa6a7..815dbfbdb8e7855f35c21944cdb77119dc317e0d 100644 (file)
-/*
- * Array test program for CUPS.
- *
- * Copyright 2007-2014 by Apple Inc.
- * Copyright 1997-2006 by Easy Software Products.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
- */
-
-/*
- * Include necessary headers...
- */
+//
+// Array test program for CUPS.
+//
+// Copyright Â© 2021-2023 by OpenPrinting.
+// Copyright Â©Â 2007-2014 by Apple Inc.
+// Copyright Â©Â 1997-2006 by Easy Software Products.
+//
+// Licensed under Apache License v2.0.  See the file "LICENSE" for more
+// information.
+//
 
-#include "cups.h"
 #include "string-private.h"
 #include "debug-private.h"
-#include "array-private.h"
+#include "cups.h"
 #include "dir.h"
+#include "test-internal.h"
 
 
-/*
- * Local functions...
- */
+//
+// Local functions...
+//
 
 static double  get_seconds(void);
 static int     load_words(const char *filename, cups_array_t *array);
 
 
-/*
- * 'main()' - Main entry.
- */
+//
+// 'main()' - Main entry.
+//
 
-int                                    /* O - Exit status */
+int                                    // O - Exit status
 main(void)
 {
-  int          i;                      /* Looping var */
-  cups_array_t *array,                 /* Test array */
-               *dup_array;             /* Duplicate array */
-  int          status;                 /* Exit status */
-  char         *text;                  /* Text from array */
-  char         word[256];              /* Word from file */
-  double       start,                  /* Start time */
-               end;                    /* End time */
-  cups_dir_t   *dir;                   /* Current directory */
-  cups_dentry_t        *dent;                  /* Directory entry */
-  char         *saved[32];             /* Saved entries */
-  void         *data;                  /* User data for arrays */
-
-
- /*
-  * No errors so far...
-  */
-
+  int          i;                      // Looping var
+  cups_array_t *array,                 // Test array
+               *dup_array;             // Duplicate array
+  int          status;                 // Exit status
+  char         *text;                  // Text from array
+  char         word[256];              // Word from file
+  double       start,                  // Start time
+               end;                    // End time
+  cups_dir_t   *dir;                   // Current directory
+  cups_dentry_t        *dent;                  // Directory entry
+  char         *saved[32];             // Saved entries
+  void         *data;                  // User data for arrays
+
+
+  // No errors so far...
   status = 0;
 
- /*
-  * cupsArrayNew()
-  */
-
-  fputs("cupsArrayNew: ", stdout);
+  // cupsArrayNew()
+  testBegin("cupsArrayNew3");
 
   data  = (void *)"testarray";
-  array = cupsArrayNew((cups_array_func_t)strcmp, data);
+  array = cupsArrayNew3((cups_array_cb_t)strcmp, data, NULL, 0, (cups_acopy_cb_t)strdup, (cups_afree_cb_t)free);
 
   if (array)
-    puts("PASS");
+  {
+    testEnd(true);
+  }
   else
   {
-    puts("FAIL (returned NULL, expected pointer)");
+    testEndMessage(false, "returned NULL, expected pointer");
     status ++;
   }
 
- /*
-  * cupsArrayUserData()
-  */
-
-  fputs("cupsArrayUserData: ", stdout);
-  if (cupsArrayUserData(array) == data)
-    puts("PASS");
+  // cupsArrayGetUserData()
+  testBegin("cupsArrayGetUserData");
+  if (cupsArrayGetUserData(array) == data)
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned %p instead of %p!)\n", cupsArrayUserData(array),
-           data);
+    testEndMessage(false, "returned %p instead of %p", cupsArrayGetUserData(array), data);
     status ++;
   }
 
- /*
-  * cupsArrayAdd()
-  */
+  // cupsArrayAdd()
+  testBegin("cupsArrayAdd");
 
-  fputs("cupsArrayAdd: ", stdout);
-
-  if (!cupsArrayAdd(array, strdup("One Fish")))
+  if (!cupsArrayAdd(array, "One Fish"))
   {
-    puts("FAIL (\"One Fish\")");
+    testEndMessage(false, "\"One Fish\"");
     status ++;
   }
   else
   {
-    if (!cupsArrayAdd(array, strdup("Two Fish")))
+    if (!cupsArrayAdd(array, "Two Fish"))
     {
-      puts("FAIL (\"Two Fish\")");
+      testEndMessage(false, "\"Two Fish\"");
       status ++;
     }
     else
     {
-      if (!cupsArrayAdd(array, strdup("Red Fish")))
+      if (!cupsArrayAdd(array, "Red Fish"))
       {
-       puts("FAIL (\"Red Fish\")");
+       testEndMessage(false, "\"Red Fish\"");
        status ++;
       }
       else
       {
-        if (!cupsArrayAdd(array, strdup("Blue Fish")))
+        if (!cupsArrayAdd(array, "Blue Fish"))
        {
-         puts("FAIL (\"Blue Fish\")");
+         testEndMessage(false, "\"Blue Fish\"");
          status ++;
        }
        else
-         puts("PASS");
+         testEnd(true);
       }
     }
   }
 
- /*
-  * cupsArrayCount()
-  */
-
-  fputs("cupsArrayCount: ", stdout);
-  if (cupsArrayCount(array) == 4)
-    puts("PASS");
+  // cupsArrayGetCount()
+  testBegin("cupsArrayGetCount");
+  if (cupsArrayGetCount(array) == 4)
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned %d, expected 4)\n", cupsArrayCount(array));
+    testEndMessage(false, "returned %d, expected 4", cupsArrayGetCount(array));
     status ++;
   }
 
- /*
-  * cupsArrayFirst()
-  */
-
-  fputs("cupsArrayFirst: ", stdout);
-  if ((text = (char *)cupsArrayFirst(array)) != NULL &&
-      !strcmp(text, "Blue Fish"))
-    puts("PASS");
+  // cupsArrayGetFirst()
+  testBegin("cupsArrayGetFirst");
+  if ((text = (char *)cupsArrayGetFirst(array)) != NULL && !strcmp(text, "Blue Fish"))
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned \"%s\", expected \"Blue Fish\")\n", text);
+    testEndMessage(false, "returned \"%s\", expected \"Blue Fish\"", text);
     status ++;
   }
 
- /*
-  * cupsArrayNext()
-  */
-
-  fputs("cupsArrayNext: ", stdout);
-  if ((text = (char *)cupsArrayNext(array)) != NULL &&
-      !strcmp(text, "One Fish"))
-    puts("PASS");
+  // cupsArrayGetNext()
+  testBegin("cupsArrayGetNext");
+  if ((text = (char *)cupsArrayGetNext(array)) != NULL && !strcmp(text, "One Fish"))
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned \"%s\", expected \"One Fish\")\n", text);
+    testEndMessage(false, "returned \"%s\", expected \"One Fish\"", text);
     status ++;
   }
 
- /*
-  * cupsArrayLast()
-  */
-
-  fputs("cupsArrayLast: ", stdout);
-  if ((text = (char *)cupsArrayLast(array)) != NULL &&
-      !strcmp(text, "Two Fish"))
-    puts("PASS");
+  // cupsArrayGetLast()
+  testBegin("cupsArrayGetLast");
+  if ((text = (char *)cupsArrayGetLast(array)) != NULL && !strcmp(text, "Two Fish"))
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned \"%s\", expected \"Two Fish\")\n", text);
+    testEndMessage(false, "returned \"%s\", expected \"Two Fish\"", text);
     status ++;
   }
 
- /*
-  * cupsArrayPrev()
-  */
-
-  fputs("cupsArrayPrev: ", stdout);
-  if ((text = (char *)cupsArrayPrev(array)) != NULL &&
-      !strcmp(text, "Red Fish"))
-    puts("PASS");
+  // cupsArrayGetPrev()
+  testBegin("cupsArrayGetPrev");
+  if ((text = (char *)cupsArrayGetPrev(array)) != NULL && !strcmp(text, "Red Fish"))
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned \"%s\", expected \"Red Fish\")\n", text);
+    testEndMessage(false, "returned \"%s\", expected \"Red Fish\"", text);
     status ++;
   }
 
- /*
-  * cupsArrayFind()
-  */
-
-  fputs("cupsArrayFind: ", stdout);
-  if ((text = (char *)cupsArrayFind(array, (void *)"One Fish")) != NULL &&
-      !strcmp(text, "One Fish"))
-    puts("PASS");
+  // cupsArrayFind()
+  testBegin("cupsArrayFind");
+  if ((text = (char *)cupsArrayFind(array, (void *)"One Fish")) != NULL && !strcmp(text, "One Fish"))
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned \"%s\", expected \"One Fish\")\n", text);
+    testEndMessage(false, "returned \"%s\", expected \"One Fish\"", text);
     status ++;
   }
 
- /*
-  * cupsArrayCurrent()
-  */
-
-  fputs("cupsArrayCurrent: ", stdout);
-  if ((text = (char *)cupsArrayCurrent(array)) != NULL &&
-      !strcmp(text, "One Fish"))
-    puts("PASS");
+  // cupsArrayGetCurrent()
+  testBegin("cupsArrayGetCurrent");
+  if ((text = (char *)cupsArrayGetCurrent(array)) != NULL && !strcmp(text, "One Fish"))
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned \"%s\", expected \"One Fish\")\n", text);
+    testEndMessage(false, "returned \"%s\", expected \"One Fish\"", text);
     status ++;
   }
 
- /*
-  * cupsArrayDup()
-  */
-
-  fputs("cupsArrayDup: ", stdout);
-  if ((dup_array = cupsArrayDup(array)) != NULL &&
-      cupsArrayCount(dup_array) == 4)
-    puts("PASS");
+  // cupsArrayDup()
+  testBegin("cupsArrayDup");
+  if ((dup_array = cupsArrayDup(array)) != NULL && cupsArrayGetCount(dup_array) == 4)
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned %p with %d elements, expected pointer with 4 elements)\n", (void *)dup_array, cupsArrayCount(dup_array));
+    testEndMessage(false, "returned %p with %d elements, expected pointer with 4 elements", (void *)dup_array, cupsArrayGetCount(dup_array));
     status ++;
   }
 
- /*
-  * cupsArrayRemove()
-  */
-
-  fputs("cupsArrayRemove: ", stdout);
-  if (cupsArrayRemove(array, (void *)"One Fish") &&
-      cupsArrayCount(array) == 3)
-    puts("PASS");
+  // cupsArrayRemove()
+  testBegin("cupsArrayRemove");
+  if (cupsArrayRemove(array, (void *)"One Fish") && cupsArrayGetCount(array) == 3)
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (returned 0 with %d elements, expected 1 with 4 elements)\n",
-           cupsArrayCount(array));
+    testEndMessage(false, "returned 0 with %d elements, expected 1 with 4 elements", cupsArrayGetCount(array));
     status ++;
   }
 
- /*
-  * cupsArrayClear()
-  */
-
-  fputs("cupsArrayClear: ", stdout);
+  // cupsArrayClear()
+  testBegin("cupsArrayClear");
   cupsArrayClear(array);
-  if (cupsArrayCount(array) == 0)
-    puts("PASS");
+  if (cupsArrayGetCount(array) == 0)
+  {
+    testEnd(true);
+  }
   else
   {
-    printf("FAIL (%d elements, expected 0 elements)\n",
-           cupsArrayCount(array));
+    testEndMessage(false, "%d elements, expected 0 elements", cupsArrayGetCount(array));
     status ++;
   }
 
- /*
-  * Now load this source file and grab all of the unique words...
-  */
-
-  fputs("Load unique words: ", stdout);
-  fflush(stdout);
+  // Now load this source file and grab all of the unique words...
+  testBegin("Load unique words");
 
   start = get_seconds();
 
   if ((dir = cupsDirOpen(".")) == NULL)
   {
-    puts("FAIL (cupsDirOpen failed)");
+    testEndMessage(false, "cupsDirOpen failed");
     status ++;
   }
   else
   {
+    bool load_status = true;           // Load status
+
     while ((dent = cupsDirRead(dir)) != NULL)
     {
       i = (int)strlen(dent->filename) - 2;
 
-      if (i > 0 && dent->filename[i] == '.' &&
-          (dent->filename[i + 1] == 'c' ||
-          dent->filename[i + 1] == 'h'))
-       load_words(dent->filename, array);
+      if (i > 0 && dent->filename[i] == '.' && (dent->filename[i + 1] == 'c' || dent->filename[i + 1] == 'h'))
+      {
+       if (!load_words(dent->filename, array))
+       {
+         load_status = false;
+         break;
+       }
+      }
     }
 
     cupsDirClose(dir);
 
-    end = get_seconds();
-
-    printf("%d words in %.3f seconds (%.0f words/sec), ", cupsArrayCount(array),
-           end - start, cupsArrayCount(array) / (end - start));
-    fflush(stdout);
-
-    for (text = (char *)cupsArrayFirst(array); text;)
+    if (load_status)
     {
-     /*
-      * Copy this word to the word buffer (safe because we strdup'd from
-      * the same buffer in the first place... :)
-      */
-
-      cupsCopyString(word, text, sizeof(word));
+      end = get_seconds();
 
-     /*
-      * Grab the next word and compare...
-      */
+      for (text = (char *)cupsArrayGetFirst(array); text;)
+      {
+        // Copy this word to the word buffer (safe because we strdup'd from
+       // the same buffer in the first place... :)
+       cupsCopyString(word, text, sizeof(word));
 
-      if ((text = (char *)cupsArrayNext(array)) == NULL)
-       break;
+        // Grab the next word and compare...
+       if ((text = (char *)cupsArrayGetNext(array)) == NULL)
+         break;
 
-      if (strcmp(word, text) >= 0)
-       break;
-    }
+       if (strcmp(word, text) >= 0)
+         break;
+      }
 
-    if (text)
-    {
-      printf("FAIL (\"%s\" >= \"%s\"!)\n", word, text);
-      status ++;
+      if (text)
+      {
+       testEndMessage(false, "\"%s\" >= \"%s\"", word, text);
+       status ++;
+      }
+      else
+      {
+       testEndMessage(true, "%d words in %.3f seconds - %.0f words/sec", cupsArrayGetCount(array), end - start, cupsArrayGetCount(array) / (end - start));
+      }
     }
-    else
-      puts("PASS");
   }
 
- /*
-  * Test deleting with iteration...
-  */
-
-  fputs("Delete While Iterating: ", stdout);
+  // Test deleting with iteration...
+  testBegin("Delete While Iterating");
 
-  text = (char *)cupsArrayFirst(array);
+  text = (char *)cupsArrayGetFirst(array);
   cupsArrayRemove(array, text);
-  free(text);
 
-  text = (char *)cupsArrayNext(array);
+  text = (char *)cupsArrayGetNext(array);
   if (!text)
   {
-    puts("FAIL (cupsArrayNext returned NULL!)");
+    testEndMessage(false, "cupsArrayGetNext returned NULL");
     status ++;
   }
   else
-    puts("PASS");
-
- /*
-  * Test save/restore...
-  */
+  {
+    testEnd(true);
+  }
 
-  fputs("cupsArraySave: ", stdout);
+  // Test save/restore...
+  testBegin("cupsArraySave");
 
-  for (i = 0, text = (char *)cupsArrayFirst(array);
-       i < 32;
-       i ++, text = (char *)cupsArrayNext(array))
+  for (i = 0, text = (char *)cupsArrayGetFirst(array); i < 32; i ++, text = (char *)cupsArrayGetNext(array))
   {
     saved[i] = text;
 
@@ -362,11 +321,11 @@ main(void)
   }
 
   if (i < 32)
-    printf("FAIL (depth = %d)\n", i);
+    testEndMessage(false, "depth = %d", i);
   else
-    puts("PASS");
+    testEnd(true);
 
-  fputs("cupsArrayRestore: ", stdout);
+  testBegin("cupsArrayRestore");
 
   while (i > 0)
   {
@@ -378,115 +337,129 @@ main(void)
   }
 
   if (i)
-    printf("FAIL (depth = %d)\n", i);
+    testEndMessage(false, "depth = %d", i);
   else
-    puts("PASS");
-
- /*
-  * Delete the arrays...
-  */
+    testEnd(true);
 
+  // Delete the arrays...
   cupsArrayDelete(array);
   cupsArrayDelete(dup_array);
 
- /*
-  * Test the array with string functions...
-  */
-
-  fputs("_cupsArrayNewStrings(\" \\t\\nfoo bar\\tboo\\nfar\", ' '): ", stdout);
-  array = _cupsArrayNewStrings(" \t\nfoo bar\tboo\nfar", ' ');
+  // Test the array with string functions...
+  testBegin("cupsArrayNewStrings(\" \\t\\nfoo bar\\tboo\\nfar\", ' ')");
+  array = cupsArrayNewStrings(" \t\nfoo bar\tboo\nfar", ' ');
   if (!array)
   {
     status = 1;
-    puts("FAIL (unable to create array)");
+    testEndMessage(false, "unable to create array");
   }
-  else if (cupsArrayCount(array) != 4)
+  else if (cupsArrayGetCount(array) != 4)
   {
     status = 1;
-    printf("FAIL (got %d elements, expected 4)\n", cupsArrayCount(array));
+    testEndMessage(false, "got %u elements, expected 4", (unsigned)cupsArrayGetCount(array));
   }
-  else if (strcmp(text = (char *)cupsArrayFirst(array), "bar"))
+  else if (strcmp(text = (char *)cupsArrayGetFirst(array), "bar"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"bar\")\n", text);
+    testEndMessage(false, "first element \"%s\", expected \"bar\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "boo"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "boo"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"boo\")\n", text);
+    testEndMessage(false, "second element \"%s\", expected \"boo\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "far"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "far"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"far\")\n", text);
+    testEndMessage(false, "third element \"%s\", expected \"far\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "foo"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "foo"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"foo\")\n", text);
+    testEndMessage(false, "fourth element \"%s\", expected \"foo\"", text);
   }
   else
-    puts("PASS");
+  {
+    testEnd(true);
+  }
 
-  fputs("_cupsArrayAddStrings(array, \"foo2,bar2\", ','): ", stdout);
-  _cupsArrayAddStrings(array, "foo2,bar2", ',');
+  testBegin("cupsArrayAddStrings(array, \"foo2,bar2\", ',')");
+  cupsArrayAddStrings(array, "foo2,bar2", ',');
 
-  if (cupsArrayCount(array) != 6)
+  if (cupsArrayGetCount(array) != 6)
   {
     status = 1;
-    printf("FAIL (got %d elements, expected 6)\n", cupsArrayCount(array));
+    testEndMessage(false, "got %u elements, expected 6", (unsigned)cupsArrayGetCount(array));
   }
-  else if (strcmp(text = (char *)cupsArrayFirst(array), "bar"))
+  else if (strcmp(text = (char *)cupsArrayGetFirst(array), "bar"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"bar\")\n", text);
+    testEndMessage(false, "first element \"%s\", expected \"bar\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "bar2"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "bar2"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"bar2\")\n", text);
+    testEndMessage(false, "second element \"%s\", expected \"bar2\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "boo"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "boo"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"boo\")\n", text);
+    testEndMessage(false, "third element \"%s\", expected \"boo\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "far"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "far"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"far\")\n", text);
+    testEndMessage(false, "fourth element \"%s\", expected \"far\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "foo"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "foo"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"foo\")\n", text);
+    testEndMessage(false, "fifth element \"%s\", expected \"foo\"", text);
   }
-  else if (strcmp(text = (char *)cupsArrayNext(array), "foo2"))
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "foo2"))
   {
     status = 1;
-    printf("FAIL (first element \"%s\", expected \"foo2\")\n", text);
+    testEndMessage(false, "sixth element \"%s\", expected \"foo2\"", text);
   }
   else
-    puts("PASS");
+    testEnd(true);
 
   cupsArrayDelete(array);
 
- /*
-  * Summarize the results and return...
-  */
-
-  if (!status)
-    puts("\nALL TESTS PASSED!");
+  testBegin("cupsArrayNewStrings(\"{value='foo'},{value=\"bar\"}\", ',')");
+  array = cupsArrayNewStrings("{value='foo'},{value=\"bar\"}", ',');
+  if (!array)
+  {
+    status = 1;
+    testEndMessage(false, "unable to create array");
+  }
+  else if (cupsArrayGetCount(array) != 2)
+  {
+    status = 1;
+    testEndMessage(false, "got %u elements, expected 2", (unsigned)cupsArrayGetCount(array));
+  }
+  else if (strcmp(text = (char *)cupsArrayGetFirst(array), "{value=\"bar\"}"))
+  {
+    status = 1;
+    testEndMessage(false, "first element \"%s\", expected \"{value=\"var\"}\"", text);
+  }
+  else if (strcmp(text = (char *)cupsArrayGetNext(array), "{value='foo'}"))
+  {
+    status = 1;
+    testEndMessage(false, "second element \"%s\", expected \"{value='foo'}\"", text);
+  }
   else
-    printf("\n%d TEST(S) FAILED!\n", status);
+    testEnd(true);
+
+  cupsArrayDelete(array);
 
   return (status);
 }
 
 
-/*
- * 'get_seconds()' - Get the current time in seconds...
- */
+//
+// 'get_seconds()' - Get the current time in seconds...
+//
 
 #ifdef _WIN32
 #  include <windows.h>
@@ -503,37 +476,39 @@ get_seconds(void)
 static double
 get_seconds(void)
 {
-  struct timeval       curtime;        /* Current time */
+  struct timeval       curtime;        // Current time
 
 
   gettimeofday(&curtime, NULL);
   return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
 }
-#endif /* _WIN32 */
+#endif // _WIN32
 
 
-/*
- * 'load_words()' - Load words from a file.
- */
+//
+// 'load_words()' - Load words from a file.
+//
 
-static int                             /* O - 1 on success, 0 on failure */
-load_words(const char   *filename,     /* I - File to load */
-           cups_array_t *array)                /* I - Array to add to */
+static int                             // O - 1 on success, 0 on failure
+load_words(const char   *filename,     // I - File to load
+           cups_array_t *array)                // I - Array to add to
 {
-  FILE         *fp;                    /* Test file */
-  char         word[256];              /* Word from file */
+  FILE         *fp;                    // Test file
+  char         word[256];              // Word from file
+
 
+  testProgress();
 
   if ((fp = fopen(filename, "r")) == NULL)
   {
-    perror(filename);
+    testEndMessage(false, "%s: %s", filename, strerror(errno));
     return (0);
   }
 
   while (fscanf(fp, "%255s", word) == 1)
   {
     if (!cupsArrayFind(array, word))
-      cupsArrayAdd(array, strdup(word));
+      cupsArrayAdd(array, word);
   }
 
   fclose(fp);
index 5af0286682c05879ea76304880f9c5c7471464ef..7bb20a05d4a93d510b0ebecec7f771a6a5f6c627 100644 (file)
@@ -1,9 +1,9 @@
 commandtops.o: commandtops.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -27,10 +27,11 @@ commandtops.o: commandtops.c ../cups/cups-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h ../cups/ppd.h ../cups/raster.h ../cups/sidechannel.h
 gziptoany.o: gziptoany.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -79,10 +80,10 @@ rastertolabel.o: rastertolabel.c ../cups/cups.h ../cups/file.h \
   ../cups/transcode.h
 rastertopwg.o: rastertopwg.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
index 6eace5be0f3cd3e23af051b7c9e371b64512463c..286de58bacc8938fb654278ecc4403954c212209 100644 (file)
@@ -1,8 +1,9 @@
 checkpo.o: checkpo.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -27,10 +28,10 @@ checkpo.o: checkpo.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/thread.h
 po2strings.o: po2strings.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
index 4c2c1ecc33d7cd09aac2f86f5500c5e0cbf950aa..ceac0989980a5ad170616659a20e04db4afa247b 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #include <cups/string-private.h>
-#include <cups/array-private.h>
+#include <cups/array.h>
 #include <unistd.h>
 
 
index cda95c4e0980a73bd91323b65bb2439e1eb7d822..880c59c1ee0c67a8b01f299b57b729c6be188417 100644 (file)
@@ -1,8 +1,8 @@
 bcp.o: bcp.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
-  ../cups/versioning.h ../cups/array-private.h ../cups/array.h \
+  ../cups/versioning.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -26,10 +26,11 @@ bcp.o: bcp.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h ../cups/ppd.h ../cups/raster.h
 tbcp.o: tbcp.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
index 48cb916393d02cfe52bdd043ea27cbf9d3254def..107e0d3393b45823e042d0f55447db76b65ab6e9 100644 (file)
@@ -2,10 +2,11 @@ dbus.o: dbus.c ../cups/cups.h ../cups/file.h ../cups/versioning.h \
   ../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/language.h \
   ../cups/pwg.h ../cups/string-private.h ../config.h
 mailto.o: mailto.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -34,10 +35,10 @@ rss.o: rss.c ../cups/cups.h ../cups/file.h ../cups/versioning.h \
   ../cups/ipp-private.h
 testnotify.o: testnotify.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
index a0f6f5329e065997f3c4d868badbf7fe02a0bfca..dc0dbdc0e6c079ea345574acf4a0dfb7e0ad438a 100644 (file)
@@ -1,9 +1,9 @@
 ppdc-array.o: ppdc-array.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -28,10 +28,10 @@ ppdc-array.o: ppdc-array.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-attr.o: ppdc-attr.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -56,10 +56,10 @@ ppdc-attr.o: ppdc-attr.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-catalog.o: ppdc-catalog.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -84,10 +84,10 @@ ppdc-catalog.o: ppdc-catalog.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-choice.o: ppdc-choice.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -112,10 +112,10 @@ ppdc-choice.o: ppdc-choice.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-constraint.o: ppdc-constraint.cxx ppdc-private.h ppdc.h \
   ../cups/file.h ../cups/versioning.h ../cups/cups-private.h \
-  ../cups/string-private.h ../config.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/string-private.h ../config.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/language.h \
+  ../cups/pwg.h ../cups/http-private.h \
   \
   \
   \
@@ -140,10 +140,10 @@ ppdc-constraint.o: ppdc-constraint.cxx ppdc-private.h ppdc.h \
   ../cups/thread.h
 ppdc-driver.o: ppdc-driver.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -168,10 +168,10 @@ ppdc-driver.o: ppdc-driver.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-file.o: ppdc-file.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -196,10 +196,10 @@ ppdc-file.o: ppdc-file.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-filter.o: ppdc-filter.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -224,10 +224,10 @@ ppdc-filter.o: ppdc-filter.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-font.o: ppdc-font.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -252,10 +252,10 @@ ppdc-font.o: ppdc-font.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-group.o: ppdc-group.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -280,10 +280,10 @@ ppdc-group.o: ppdc-group.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-import.o: ppdc-import.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -308,10 +308,10 @@ ppdc-import.o: ppdc-import.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h ../cups/ppd.h ../cups/raster.h
 ppdc-mediasize.o: ppdc-mediasize.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -336,10 +336,10 @@ ppdc-mediasize.o: ppdc-mediasize.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-message.o: ppdc-message.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -364,10 +364,10 @@ ppdc-message.o: ppdc-message.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-option.o: ppdc-option.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -392,10 +392,10 @@ ppdc-option.o: ppdc-option.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-profile.o: ppdc-profile.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -420,10 +420,10 @@ ppdc-profile.o: ppdc-profile.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-shared.o: ppdc-shared.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -448,10 +448,10 @@ ppdc-shared.o: ppdc-shared.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-source.o: ppdc-source.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -477,10 +477,10 @@ ppdc-source.o: ppdc-source.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../data/label.h
 ppdc-string.o: ppdc-string.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -505,10 +505,10 @@ ppdc-string.o: ppdc-string.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc-variable.o: ppdc-variable.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -533,10 +533,10 @@ ppdc-variable.o: ppdc-variable.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 genstrings.o: genstrings.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -561,10 +561,10 @@ genstrings.o: genstrings.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdc.o: ppdc.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -589,10 +589,10 @@ ppdc.o: ppdc.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdhtml.o: ppdhtml.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -617,10 +617,10 @@ ppdhtml.o: ppdhtml.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 ppdi.o: ppdi.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -644,10 +644,11 @@ ppdi.o: ppdi.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 ppdmerge.o: ppdmerge.cxx ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -672,10 +673,10 @@ ppdmerge.o: ppdmerge.cxx ../cups/cups-private.h ../cups/string-private.h \
   ../cups/thread.h ../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h
 ppdpo.o: ppdpo.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -700,10 +701,10 @@ ppdpo.o: ppdpo.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/thread.h
 testcatalog.o: testcatalog.cxx ppdc-private.h ppdc.h ../cups/file.h \
   ../cups/versioning.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/array-private.h ../cups/array.h \
+  ../config.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
index 79abde99803990e99a77030cdd41bf60bcfc6974..4e449e42a4d1caacecf1de6d06c9019b48a176eb 100644 (file)
@@ -1,8 +1,9 @@
 auth.o: auth.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -30,10 +31,10 @@ auth.o: auth.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 banners.o: banners.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -60,10 +61,11 @@ banners.o: banners.c cupsd.h ../cups/cups-private.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h ../cups/dir.h
 cert.o: cert.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -91,10 +93,10 @@ cert.o: cert.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 classes.o: classes.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -122,10 +124,10 @@ classes.o: classes.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 client.o: client.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -153,10 +155,10 @@ client.o: client.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 colorman.o: colorman.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -183,10 +185,11 @@ colorman.o: colorman.c cupsd.h ../cups/cups-private.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h
 conf.o: conf.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -214,10 +217,10 @@ conf.o: conf.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 dirsvc.o: dirsvc.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -244,10 +247,11 @@ dirsvc.o: dirsvc.c cupsd.h ../cups/cups-private.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h
 env.o: env.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -274,10 +278,11 @@ env.o: env.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h
 file.o: file.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -304,10 +309,11 @@ file.o: file.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h ../cups/dir.h
 main.o: main.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -334,10 +340,11 @@ main.o: main.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h
 ipp.o: ipp.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -365,10 +372,10 @@ ipp.o: ipp.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 listen.o: listen.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -395,10 +402,11 @@ listen.o: listen.c cupsd.h ../cups/cups-private.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h
 job.o: job.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -426,10 +434,11 @@ job.o: job.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
   banners.h dirsvc.h network.h subscriptions.h ../cups/backend.h \
   ../cups/dir.h
 log.o: log.c cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -480,18 +489,19 @@ network.o: network.c ../cups/http-private.h ../config.h \
   \
   \
   cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../cups/array-private.h ../cups/language-private.h ../cups/transcode.h \
-  ../cups/pwg-private.h ../cups/thread.h ../cups/file-private.h \
-  ../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h mime.h sysman.h \
-  statbuf.h cert.h auth.h client.h policy.h printers.h classes.h job.h \
-  colorman.h conf.h banners.h dirsvc.h network.h subscriptions.h \
+  ../cups/debug-internal.h ../cups/debug-private.h \
+  ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
+  ../cups/thread.h ../cups/file-private.h ../cups/ppd-private.h \
+  ../cups/ppd.h ../cups/raster.h mime.h sysman.h statbuf.h cert.h auth.h \
+  client.h policy.h printers.h classes.h job.h colorman.h conf.h \
+  banners.h dirsvc.h network.h subscriptions.h \
   ../cups/getifaddrs-internal.h
 policy.o: policy.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -519,10 +529,10 @@ policy.o: policy.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 printers.o: printers.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -550,10 +560,10 @@ printers.o: printers.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h ../cups/dir.h
 process.o: process.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -581,10 +591,10 @@ process.o: process.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 quotas.o: quotas.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -612,10 +622,10 @@ quotas.o: quotas.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 select.o: select.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -666,17 +676,18 @@ server.o: server.c ../cups/http-private.h ../config.h ../cups/language.h \
   \
   \
   cupsd.h ../cups/cups-private.h ../cups/string-private.h \
-  ../cups/array-private.h ../cups/language-private.h ../cups/transcode.h \
-  ../cups/pwg-private.h ../cups/thread.h ../cups/file-private.h \
-  ../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h mime.h sysman.h \
-  statbuf.h cert.h auth.h client.h policy.h printers.h classes.h job.h \
-  colorman.h conf.h banners.h dirsvc.h network.h subscriptions.h
+  ../cups/debug-internal.h ../cups/debug-private.h \
+  ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
+  ../cups/thread.h ../cups/file-private.h ../cups/ppd-private.h \
+  ../cups/ppd.h ../cups/raster.h mime.h sysman.h statbuf.h cert.h auth.h \
+  client.h policy.h printers.h classes.h job.h colorman.h conf.h \
+  banners.h dirsvc.h network.h subscriptions.h
 statbuf.o: statbuf.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -704,10 +715,10 @@ statbuf.o: statbuf.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 subscriptions.o: subscriptions.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -735,10 +746,10 @@ subscriptions.o: subscriptions.c cupsd.h ../cups/cups-private.h \
   banners.h dirsvc.h network.h subscriptions.h
 sysman.o: sysman.c cupsd.h ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -764,21 +775,24 @@ sysman.o: sysman.c cupsd.h ../cups/cups-private.h \
   ../cups/ppd.h ../cups/raster.h mime.h sysman.h statbuf.h cert.h auth.h \
   client.h policy.h printers.h classes.h job.h colorman.h conf.h \
   banners.h dirsvc.h network.h subscriptions.h
-filter.o: filter.c ../cups/string-private.h ../config.h \
-  ../cups/versioning.h mime.h ../cups/array.h ../cups/ipp.h \
-  ../cups/http.h ../cups/file.h ../cups/thread.h
-mime.o: mime.c ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/dir.h mime-private.h mime.h ../cups/array.h ../cups/ipp.h \
-  ../cups/http.h ../cups/file.h ../cups/thread.h
-type.o: type.c ../cups/string-private.h ../config.h ../cups/versioning.h \
-  mime.h ../cups/array.h ../cups/ipp.h ../cups/http.h ../cups/file.h \
+filter.o: filter.c ../cups/cups.h ../cups/file.h ../cups/versioning.h \
+  ../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/language.h \
+  ../cups/pwg.h ../cups/string-private.h ../config.h mime.h \
+  ../cups/thread.h
+mime.o: mime.c ../cups/cups.h ../cups/file.h ../cups/versioning.h \
+  ../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/language.h \
+  ../cups/pwg.h ../cups/string-private.h ../config.h ../cups/dir.h \
+  mime-private.h mime.h ../cups/thread.h
+type.o: type.c ../cups/cups.h ../cups/file.h ../cups/versioning.h \
+  ../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/language.h \
+  ../cups/pwg.h ../cups/string-private.h ../config.h mime.h \
   ../cups/thread.h
 cupsfilter.o: cupsfilter.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -802,12 +816,12 @@ cupsfilter.o: cupsfilter.c ../cups/cups-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h ../cups/file-private.h ../cups/ppd-private.h \
   ../cups/ppd.h ../cups/raster.h mime.h
-cups-deviced.o: cups-deviced.c util.h ../cups/array-private.h \
-  ../cups/array.h ../cups/versioning.h ../cups/file-private.h \
+cups-deviced.o: cups-deviced.c util.h ../cups/file-private.h \
   ../cups/cups-private.h ../cups/string-private.h ../config.h \
+  ../cups/versioning.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -833,10 +847,11 @@ cups-deviced.o: cups-deviced.c util.h ../cups/array-private.h \
 cups-exec.o: cups-exec.c ../cups/string-private.h ../config.h \
   ../cups/versioning.h ../cups/file.h
 cups-lpd.o: cups-lpd.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -876,12 +891,12 @@ testsub.o: testsub.c ../cups/cups.h ../cups/file.h ../cups/versioning.h \
   ../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/language.h \
   ../cups/pwg.h ../cups/debug-private.h ../cups/string-private.h \
   ../config.h ../cups/ipp-private.h
-util.o: util.c util.h ../cups/array-private.h ../cups/array.h \
-  ../cups/versioning.h ../cups/file-private.h ../cups/cups-private.h \
-  ../cups/string-private.h ../config.h ../cups/ipp-private.h \
+util.o: util.c util.h ../cups/file-private.h ../cups/cups-private.h \
+  ../cups/string-private.h ../config.h ../cups/versioning.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -904,12 +919,12 @@ util.o: util.c util.h ../cups/array-private.h ../cups/array.h \
   \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
-cups-driverd.o: cups-driverd.cxx util.h ../cups/array-private.h \
-  ../cups/array.h ../cups/versioning.h ../cups/file-private.h \
+cups-driverd.o: cups-driverd.cxx util.h ../cups/file-private.h \
   ../cups/cups-private.h ../cups/string-private.h ../config.h \
+  ../cups/versioning.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
index 1e70a17ce1b72371994f19c74578265f8cd78406..4ada086ddd07247707a1af9ac99a6cafe4b1cae1 100644 (file)
@@ -72,13 +72,13 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
 #endif /* HAVE_TCPD_H */
 
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAcceptClient(lis=%p(%d)) Clients=%d", lis, lis->fd, cupsArrayCount(Clients));
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAcceptClient(lis=%p(%d)) Clients=%d", lis, lis->fd, cupsArrayGetCount(Clients));
 
  /*
   * Make sure we don't have a full set of clients already...
   */
 
-  if (cupsArrayCount(Clients) == MaxClients)
+  if (cupsArrayGetCount(Clients) == MaxClients)
     return;
 
   cupsdSetBusyState(1);
@@ -88,7 +88,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   */
 
   if (!Clients)
-    Clients = cupsArrayNew(NULL, NULL);
+    Clients = cupsArrayNew3(NULL, NULL, NULL, 0, NULL, NULL);
 
   if (!Clients)
   {
@@ -99,7 +99,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   }
 
   if (!ActiveClients)
-    ActiveClients = cupsArrayNew((cups_array_func_t)compare_clients, NULL);
+    ActiveClients = cupsArrayNew3((cups_array_func_t)compare_clients, NULL, NULL, 0, NULL, NULL);
 
   if (!ActiveClients)
   {
@@ -150,9 +150,9 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   * Check the number of clients on the same address...
   */
 
-  for (count = 0, tempcon = (cupsd_client_t *)cupsArrayFirst(Clients);
+  for (count = 0, tempcon = (cupsd_client_t *)cupsArrayGetFirst(Clients);
        tempcon;
-       tempcon = (cupsd_client_t *)cupsArrayNext(Clients))
+       tempcon = (cupsd_client_t *)cupsArrayGetNext(Clients))
     if (httpAddrIsEqual(httpGetAddress(tempcon->http), httpGetAddress(con->http)))
     {
       count ++;
@@ -347,7 +347,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
   * Temporarily suspend accept()'s until we lose a client...
   */
 
-  if (cupsArrayCount(Clients) == MaxClients)
+  if (cupsArrayGetCount(Clients) == MaxClients)
     cupsdPauseListening();
 
  /*
@@ -378,11 +378,11 @@ cupsdCloseAllClients(void)
   cupsd_client_t       *con;           /* Current client */
 
 
-  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCloseAllClients() Clients=%d", cupsArrayCount(Clients));
+  cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCloseAllClients() Clients=%d", cupsArrayGetCount(Clients));
 
-  for (con = (cupsd_client_t *)cupsArrayFirst(Clients);
+  for (con = (cupsd_client_t *)cupsArrayGetFirst(Clients);
        con;
-       con = (cupsd_client_t *)cupsArrayNext(Clients))
+       con = (cupsd_client_t *)cupsArrayGetNext(Clients))
     if (cupsdCloseClient(con))
       cupsdCloseClient(con);
 }
@@ -517,7 +517,7 @@ cupsdCloseClient(cupsd_client_t *con)       /* I - Client to close */
     * limit...
     */
 
-    if (cupsArrayCount(Clients) == MaxClients)
+    if (cupsArrayGetCount(Clients) == MaxClients)
       cupsdResumeListening();
 
    /*
@@ -2118,9 +2118,9 @@ cupsdSendHeader(
       }
 #endif /* SO_PEERCRED && AF_LOCAL */
 
-      for (name = (char *)cupsArrayFirst(con->best->names);
+      for (name = (char *)cupsArrayGetFirst(con->best->names);
            name;
-          name = (char *)cupsArrayNext(con->best->names))
+          name = (char *)cupsArrayGetNext(con->best->names))
       {
         cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cupsdSendHeader: require \"%s\"", name);
 
@@ -3612,9 +3612,9 @@ valid_host(cupsd_client_t *con)           /* I - Client connection */
   * Check for (alias) name matches...
   */
 
-  for (a = (cupsd_alias_t *)cupsArrayFirst(ServerAlias);
+  for (a = (cupsd_alias_t *)cupsArrayGetFirst(ServerAlias);
        a;
-       a = (cupsd_alias_t *)cupsArrayNext(ServerAlias))
+       a = (cupsd_alias_t *)cupsArrayGetNext(ServerAlias))
   {
    /*
     * "ServerAlias *" allows all host values through...
@@ -3637,9 +3637,9 @@ valid_host(cupsd_client_t *con)           /* I - Client connection */
   }
 
 #ifdef HAVE_DNSSD
-  for (a = (cupsd_alias_t *)cupsArrayFirst(DNSSDAlias);
+  for (a = (cupsd_alias_t *)cupsArrayGetFirst(DNSSDAlias);
        a;
-       a = (cupsd_alias_t *)cupsArrayNext(DNSSDAlias))
+       a = (cupsd_alias_t *)cupsArrayGetNext(DNSSDAlias))
   {
    /*
     * "ServerAlias *" allows all host values through...
@@ -3666,9 +3666,9 @@ valid_host(cupsd_client_t *con)           /* I - Client connection */
   * Check for interface hostname matches...
   */
 
-  for (netif = (cupsd_netif_t *)cupsArrayFirst(NetIFList);
+  for (netif = (cupsd_netif_t *)cupsArrayGetFirst(NetIFList);
        netif;
-       netif = (cupsd_netif_t *)cupsArrayNext(NetIFList))
+       netif = (cupsd_netif_t *)cupsArrayGetNext(NetIFList))
   {
     if (!_cups_strncasecmp(con->clientname, netif->hostname, netif->hostlen))
     {
index b6cd419e03d38d98c00be713dd12c59c0b429d40..e555d777b35a6f3dd149cee838649b62e25a547c 100644 (file)
@@ -1253,11 +1253,11 @@ cupsdReadConfiguration(void)
   {
     // Build default list of common sizes for North America and worldwide...
     if (!strcasecmp(DefaultPaperSize, "Letter"))
-      ReadyPaperSizes = _cupsArrayNewStrings("Letter,Legal,Tabloid,4x6,Env10", ',');
+      ReadyPaperSizes = cupsArrayNewStrings("Letter,Legal,Tabloid,4x6,Env10", ',');
     else if (!strcasecmp(DefaultPaperSize, "A4"))
-      ReadyPaperSizes = _cupsArrayNewStrings("A4,A3,A5,A6,EnvDL", ',');
+      ReadyPaperSizes = cupsArrayNewStrings("A4,A3,A5,A6,EnvDL", ',');
     else
-      ReadyPaperSizes = _cupsArrayNewStrings(DefaultPaperSize, ',');
+      ReadyPaperSizes = cupsArrayNewStrings(DefaultPaperSize, ',');
   }
 
  /*
@@ -3314,9 +3314,9 @@ read_cupsd_conf(cups_file_t *fp)  /* I - File to read from */
       */
 
       if (ReadyPaperSizes)
-        _cupsArrayAddStrings(ReadyPaperSizes, value, ',');
+        cupsArrayAddStrings(ReadyPaperSizes, value, ',');
       else
-        ReadyPaperSizes = _cupsArrayNewStrings(value, ',');
+        ReadyPaperSizes = cupsArrayNewStrings(value, ',');
     }
     else if (!_cups_strcasecmp(line, "ServerTokens") && value)
     {
index 655a07eb3464721c5ef2db5a2b54d4993dab2d3b..3138895fc09538fbb40f5d6d4681dab2456feb22 100644 (file)
@@ -143,7 +143,7 @@ cups_array_t *                              /* O - CUPS array */
 cupsdCreateStringsArray(const char *s) /* I - Comma-delimited strings */
 {
   if (s && *s)
-    return (_cupsArrayNewStrings(s, ','));
+    return (cupsArrayNewStrings(s, ','));
   else
     return (NULL);
 }
index 6fa8dfd244e1ba3b69c8e801080f1b9d3a5a945b..0f4af6ad86f804aa2e07fc500c5fd2d6378c4796 100644 (file)
@@ -14,7 +14,6 @@
  * Include necessary headers...
  */
 
-#  include <cups/array-private.h>
 #  include <cups/file-private.h>
 #  include <signal.h>
 
index b48662771e935552af42ad1e43dafc91d6d6ae4c..0bc424c5ff96d8ea2e76665f6a02b0524899abbf 100644 (file)
@@ -1,8 +1,9 @@
 cancel.o: cancel.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -27,10 +28,10 @@ cancel.o: cancel.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/thread.h
 cupsaccept.o: cupsaccept.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -54,10 +55,11 @@ cupsaccept.o: cupsaccept.c ../cups/cups-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 cupsctl.o: cupsctl.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -82,10 +84,10 @@ cupsctl.o: cupsctl.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/thread.h ../cups/adminutil.h
 cupstestppd.o: cupstestppd.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -110,10 +112,10 @@ cupstestppd.o: cupstestppd.c ../cups/cups-private.h \
   ../cups/thread.h ../cups/dir.h ../cups/ppd-private.h ../cups/ppd.h \
   ../cups/raster.h
 lp.o: lp.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
-  ../cups/versioning.h ../cups/array-private.h ../cups/array.h \
+  ../cups/versioning.h ../cups/debug-internal.h ../cups/debug-private.h \
   ../cups/ipp-private.h ../cups/cups.h ../cups/file.h ../cups/ipp.h \
-  ../cups/http.h ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/http.h ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -137,10 +139,11 @@ lp.o: lp.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 lpadmin.o: lpadmin.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -164,10 +167,11 @@ lpadmin.o: lpadmin.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h ../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h
 lpinfo.o: lpinfo.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -191,10 +195,11 @@ lpinfo.o: lpinfo.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h ../cups/adminutil.h
 lpmove.o: lpmove.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -218,10 +223,11 @@ lpmove.o: lpmove.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 lpoptions.o: lpoptions.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -245,10 +251,11 @@ lpoptions.o: lpoptions.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h ../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h
 lpstat.o: lpstat.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
index 025f2dc8feaed2e55dac505074cc1c21f47209e3..a1dab4ee400a5fd62ec3aa6440e67ed260ccd8d8 100644 (file)
@@ -4,10 +4,10 @@ ippevepcl.o: ippevepcl.c ippevecommon.h ../cups/cups.h ../cups/file.h \
   ../cups/string-private.h ../config.h dither.h
 ippeveprinter.o: ippeveprinter.c ../cups/cups-private.h \
   ../cups/string-private.h ../config.h ../cups/versioning.h \
-  ../cups/array-private.h ../cups/array.h ../cups/ipp-private.h \
+  ../cups/debug-internal.h ../cups/debug-private.h ../cups/ipp-private.h \
   ../cups/cups.h ../cups/file.h ../cups/ipp.h ../cups/http.h \
-  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
-  \
+  ../cups/array.h ../cups/language.h ../cups/pwg.h \
+  ../cups/http-private.h \
   \
   \
   \
@@ -29,19 +29,19 @@ ippeveprinter.o: ippeveprinter.c ../cups/cups-private.h \
   \
   \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
-  ../cups/thread.h ../cups/debug-private.h ../cups/ppd-private.h \
-  ../cups/ppd.h ../cups/raster.h printer-png.h printer-lg-png.h \
-  printer-sm-png.h
+  ../cups/thread.h ../cups/ppd-private.h ../cups/ppd.h ../cups/raster.h \
+  printer-png.h printer-lg-png.h printer-sm-png.h
 ippeveps.o: ippeveps.c ippevecommon.h ../cups/cups.h ../cups/file.h \
   ../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
   ../cups/language.h ../cups/pwg.h ../cups/raster.h \
   ../cups/string-private.h ../config.h ../cups/ppd-private.h \
   ../cups/ppd.h ../cups/pwg-private.h
 ippfind.o: ippfind.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
@@ -65,10 +65,11 @@ ippfind.o: ippfind.c ../cups/cups-private.h ../cups/string-private.h \
   ../cups/language-private.h ../cups/transcode.h ../cups/pwg-private.h \
   ../cups/thread.h
 ipptool.o: ipptool.c ../cups/cups-private.h ../cups/string-private.h \
-  ../config.h ../cups/versioning.h ../cups/array-private.h \
-  ../cups/array.h ../cups/ipp-private.h ../cups/cups.h ../cups/file.h \
-  ../cups/ipp.h ../cups/http.h ../cups/language.h ../cups/pwg.h \
-  ../cups/http-private.h \
+  ../config.h ../cups/versioning.h ../cups/debug-internal.h \
+  ../cups/debug-private.h ../cups/ipp-private.h ../cups/cups.h \
+  ../cups/file.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+  ../cups/language.h ../cups/pwg.h ../cups/http-private.h \
+  \
   \
   \
   \
index 19b887c85b8cb7a75730764fc8b7a940faef8ee2..6ebd3cfbe0d1192e002ad604c617e419dfeff130 100644 (file)
@@ -547,7 +547,7 @@ main(int  argc,                             /* I - Number of command-line args */
              if (i >= argc)
                usage(1);
 
-             docformats = _cupsArrayNewStrings(argv[i], ',');
+             docformats = cupsArrayNewStrings(argv[i], ',');
              legacy     = 1;
              break;
 
@@ -689,7 +689,7 @@ main(int  argc,                             /* I - Number of command-line args */
   */
 
   if (!docformats)
-    docformats = _cupsArrayNewStrings(ppm_color > 0 ? "image/jpeg,image/pwg-raster,image/urf": "image/pwg-raster,image/urf", ',');
+    docformats = cupsArrayNewStrings(ppm_color > 0 ? "image/jpeg,image/pwg-raster,image/urf": "image/pwg-raster,image/urf", ',');
 
   if (attrfile)
     attrs = load_ippserver_attributes(servername, serverport, attrfile, docformats);
index b46eb7dd4a9e6fcd39967025e52ddbf655478a9c..5b021e220b70d2df886de805bd2afcab1dfafa13 100644 (file)
@@ -1,19 +1,15 @@
-/*
- * Utility to find IPP printers via Bonjour/DNS-SD and optionally run
- * commands such as IPP and Bonjour conformance tests.  This tool is
- * inspired by the UNIX "find" command, thus its name.
- *
- * Copyright Â© 2021-2023 by OpenPrinting.
- * Copyright Â© 2020 by the IEEE-ISTO Printer Working Group
- * Copyright Â©Â 2008-2018 by Apple Inc.
- *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more
- * information.
- */
-
-/*
- * Include necessary headers.
- */
+//
+// Utility to find IPP printers via Bonjour/DNS-SD and optionally run
+// commands such as IPP and Bonjour conformance tests.  This tool is
+// inspired by the UNIX "find" command, thus its name.
+//
+// Copyright Â© 2021-2022 by OpenPrinting.
+// Copyright Â© 2020 by the IEEE-ISTO Printer Working Group
+// Copyright Â©Â 2008-2018 by Apple Inc.
+//
+// Licensed under Apache License v2.0.  See the file "LICENSE" for more
+// information.
+//
 
 #define _CUPS_NO_DEPRECATED
 #include <cups/cups-private.h>
 #  include <sys/timeb.h>
 #else
 #  include <sys/wait.h>
-#endif /* _WIN32 */
+#endif // _WIN32
 #include <regex.h>
-#ifdef HAVE_MDNSRESPONDER
-#  include <dns_sd.h>
-#elif defined(HAVE_AVAHI)
-#  include <avahi-client/client.h>
-#  include <avahi-client/lookup.h>
-#  include <avahi-common/simple-watch.h>
-#  include <avahi-common/domain.h>
-#  include <avahi-common/error.h>
-#  include <avahi-common/malloc.h>
-#  define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
-#endif /* HAVE_MDNSRESPONDER */
+#include <cups/dnssd.h>
 
 #ifndef _WIN32
-extern char **environ;                 /* Process environment variables */
-#endif /* !_WIN32 */
+extern char **environ;                 // Process environment variables
+#endif // !_WIN32
 
 
-/*
- * Structures...
- */
+//
+// Structures...
+//
 
-typedef enum ippfind_exit_e            /* Exit codes */
+typedef enum ippfind_exit_e            // Exit codes
 {
-  IPPFIND_EXIT_TRUE = 0,               /* OK and result is true */
-  IPPFIND_EXIT_FALSE,                  /* OK but result is false*/
-  IPPFIND_EXIT_BONJOUR,                        /* Browse/resolve failure */
-  IPPFIND_EXIT_SYNTAX,                 /* Bad option or syntax error */
-  IPPFIND_EXIT_MEMORY                  /* Out of memory */
+  IPPFIND_EXIT_TRUE = 0,               // OK and result is true
+  IPPFIND_EXIT_FALSE,                  // OK but result is false
+  IPPFIND_EXIT_BONJOUR,                        // Browse/resolve failure
+  IPPFIND_EXIT_SYNTAX,                 // Bad option or syntax error
+  IPPFIND_EXIT_MEMORY                  // Out of memory
 } ippfind_exit_t;
 
-typedef enum ippfind_op_e              /* Operations for expressions */
+typedef enum ippfind_op_e              // Operations for expressions
 {
-  /* "Evaluation" operations */
-  IPPFIND_OP_NONE,                     /* No operation */
-  IPPFIND_OP_AND,                      /* Logical AND of all children */
-  IPPFIND_OP_OR,                       /* Logical OR of all children */
-  IPPFIND_OP_TRUE,                     /* Always true */
-  IPPFIND_OP_FALSE,                    /* Always false */
-  IPPFIND_OP_IS_LOCAL,                 /* Is a local service */
-  IPPFIND_OP_IS_REMOTE,                        /* Is a remote service */
-  IPPFIND_OP_DOMAIN_REGEX,             /* Domain matches regular expression */
-  IPPFIND_OP_NAME_REGEX,               /* Name matches regular expression */
-  IPPFIND_OP_NAME_LITERAL,             /* Name matches literal string */
-  IPPFIND_OP_HOST_REGEX,               /* Hostname matches regular expression */
-  IPPFIND_OP_PORT_RANGE,               /* Port matches range */
-  IPPFIND_OP_PATH_REGEX,               /* Path matches regular expression */
-  IPPFIND_OP_TXT_EXISTS,               /* TXT record key exists */
-  IPPFIND_OP_TXT_REGEX,                        /* TXT record key matches regular expression */
-  IPPFIND_OP_URI_REGEX,                        /* URI matches regular expression */
-
-  /* "Output" operations */
-  IPPFIND_OP_EXEC,                     /* Execute when true */
-  IPPFIND_OP_LIST,                     /* List when true */
-  IPPFIND_OP_PRINT_NAME,               /* Print URI when true */
-  IPPFIND_OP_PRINT_URI,                        /* Print name when true */
-  IPPFIND_OP_QUIET                     /* No output when true */
+  // "Evaluation" operations
+  IPPFIND_OP_NONE,                     // No operation
+  IPPFIND_OP_AND,                      // Logical AND of all children
+  IPPFIND_OP_OR,                       // Logical OR of all children
+  IPPFIND_OP_TRUE,                     // Always true
+  IPPFIND_OP_FALSE,                    // Always false
+  IPPFIND_OP_IS_LOCAL,                 // Is a local service
+  IPPFIND_OP_IS_REMOTE,                        // Is a remote service
+  IPPFIND_OP_DOMAIN_REGEX,             // Domain matches regular expression
+  IPPFIND_OP_NAME_REGEX,               // Name matches regular expression
+  IPPFIND_OP_NAME_LITERAL,             // Name matches literal string
+  IPPFIND_OP_HOST_REGEX,               // Hostname matches regular expression
+  IPPFIND_OP_PORT_RANGE,               // Port matches range
+  IPPFIND_OP_PATH_REGEX,               // Path matches regular expression
+  IPPFIND_OP_TXT_EXISTS,               // TXT record key exists
+  IPPFIND_OP_TXT_REGEX,                        // TXT record key matches regular expression
+  IPPFIND_OP_URI_REGEX,                        // URI matches regular expression
+
+  // "Output" operations
+  IPPFIND_OP_EXEC,                     // Execute when true
+  IPPFIND_OP_LIST,                     // List when true
+  IPPFIND_OP_PRINT_NAME,               // Print URI when true
+  IPPFIND_OP_PRINT_URI,                        // Print name when true
+  IPPFIND_OP_QUIET                     // No output when true
 } ippfind_op_t;
 
-typedef struct ippfind_expr_s          /* Expression */
+typedef struct ippfind_expr_s          // Expression
 {
   struct ippfind_expr_s
-               *prev,                  /* Previous expression */
-               *next,                  /* Next expression */
-               *parent,                /* Parent expressions */
-               *child;                 /* Child expressions */
-  ippfind_op_t op;                     /* Operation code (see above) */
-  int          invert;                 /* Invert the result */
-  char         *name;                  /* TXT record key or literal name */
-  regex_t      re;                     /* Regular expression for matching */
-  int          range[2];               /* Port number range */
-  int          num_args;               /* Number of arguments for exec */
-  char         **args;                 /* Arguments for exec */
+               *prev,                  // Previous expression
+               *next,                  // Next expression
+               *parent,                // Parent expressions
+               *child;                 // Child expressions
+  ippfind_op_t op;                     // Operation code (see above)
+  bool         invert;                 // Invert the result?
+  char         *name;                  // TXT record key or literal name
+  regex_t      re;                     // Regular expression for matching
+  int          range[2];               // Port number range
+  size_t       num_args;               // Number of arguments for exec
+  char         **args;                 // Arguments for exec
 } ippfind_expr_t;
 
-typedef struct ippfind_srv_s           /* Service information */
+typedef struct ippfind_srvs_s          // Services array
 {
-#ifdef HAVE_MDNSRESPONDER
-  DNSServiceRef        ref;                    /* Service reference for query */
-#elif defined(HAVE_AVAHI)
-  AvahiServiceResolver *ref;           /* Resolver */
-#endif /* HAVE_MDNSRESPONDER */
-  char         *name,                  /* Service name */
-               *domain,                /* Domain name */
-               *regtype,               /* Registration type */
-               *fullName,              /* Full name */
-               *host,                  /* Hostname */
-               *resource,              /* Resource path */
-               *uri;                   /* URI */
-  int          num_txt;                /* Number of TXT record keys */
-  cups_option_t        *txt;                   /* TXT record keys */
-  int          port,                   /* Port number */
-               is_local,               /* Is a local service? */
-               is_processed,           /* Did we process the service? */
-               is_resolved;            /* Got the resolve data? */
-} ippfind_srv_t;
+  cups_rwlock_t        rwlock;                 // R/W lock
+  cups_array_t *services;              // Services array
+} ippfind_srvs_t;
 
+typedef struct ippfind_srv_s           // Service information
+{
+  cups_dnssd_resolve_t *resolve;       // Resolve request
+  char         *name,                  // Service name
+               *domain,                // Domain name
+               *regtype,               // Registration type
+               *fullName,              // Full name
+               *host,                  // Hostname
+               *resource,              // Resource path
+               *uri;                   // URI
+  size_t       num_txt;                // Number of TXT record keys
+  cups_option_t        *txt;                   // TXT record keys
+  int          port;                   // Port number
+  bool         is_local,               // Is a local service?
+               is_processed,           // Did we process the service?
+               is_resolved;            // Got the resolve data?
+} ippfind_srv_t;
 
-/*
- * Local globals...
- */
 
-#ifdef HAVE_MDNSRESPONDER
-static DNSServiceRef dnssd_ref;                /* Master service reference */
-#elif defined(HAVE_AVAHI)
-static AvahiClient *avahi_client = NULL;/* Client information */
-static int     avahi_got_data = 0;     /* Got data from poll? */
-static AvahiSimplePoll *avahi_poll = NULL;
-                                       /* Poll information */
-#endif /* HAVE_MDNSRESPONDER */
+//
+// Local globals...
+//
 
+static cups_dnssd_t *dnssd;            // DNS-SD context
 static int     address_family = AF_UNSPEC;
-                                       /* Address family for LIST */
-static int     bonjour_error = 0;      /* Error browsing/resolving? */
-static double  bonjour_timeout = 1.0;  /* Timeout in seconds */
-static int     ipp_version = 20;       /* IPP version for LIST */
-
-
-/*
- * Local functions...
- */
-
-#ifdef HAVE_MDNSRESPONDER
-static void DNSSD_API  browse_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) _CUPS_NONNULL(1,5,6,7,8);
-static void DNSSD_API  browse_local_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *serviceName, const char *regtype, const char *replyDomain, void *context) _CUPS_NONNULL(1,5,6,7,8);
-#elif defined(HAVE_AVAHI)
-static void            browse_callback(AvahiServiceBrowser *browser,
-                                       AvahiIfIndex interface,
-                                       AvahiProtocol protocol,
-                                       AvahiBrowserEvent event,
-                                       const char *serviceName,
-                                       const char *regtype,
-                                       const char *replyDomain,
-                                       AvahiLookupResultFlags flags,
-                                       void *context);
-static void            client_callback(AvahiClient *client,
-                                       AvahiClientState state,
-                                       void *context);
-#endif /* HAVE_MDNSRESPONDER */
+                                       // Address family for LIST
+static int     bonjour_error = 0;      // Error browsing/resolving?
+static double  bonjour_timeout = 1.0;  // Timeout in seconds
+static int     ipp_version = 20;       // IPP version for LIST
 
+
+//
+// Local functions...
+//
+
+static void            browse_callback(cups_dnssd_browse_t *browse, void *context, cups_dnssd_flags_t flags, uint32_t if_index, const char *serviceName, const char *regtype, const char *replyDomain);
 static int             compare_services(ippfind_srv_t *a, ippfind_srv_t *b);
-static const char      *dnssd_error_string(int error);
-static int             eval_expr(ippfind_srv_t *service,
-                                 ippfind_expr_t *expressions);
-static int             exec_program(ippfind_srv_t *service, int num_args,
-                                    char **args);
-static ippfind_srv_t   *get_service(cups_array_t *services, const char *serviceName, const char *regtype, const char *replyDomain) _CUPS_NONNULL(1,2,3,4);
+static int             eval_expr(ippfind_srv_t *service, ippfind_expr_t *expressions);
+static int             exec_program(ippfind_srv_t *service, size_t num_args, char **args);
+static ippfind_srv_t   *get_service(ippfind_srvs_t *services, const char *serviceName, const char *regtype, const char *replyDomain) _CUPS_NONNULL(1,2,3,4);
 static double          get_time(void);
 static int             list_service(ippfind_srv_t *service);
-static ippfind_expr_t  *new_expr(ippfind_op_t op, int invert,
-                                 const char *value, const char *regex,
-                                 char **args);
-#ifdef HAVE_MDNSRESPONDER
-static void DNSSD_API  resolve_callback(DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *fullName, const char *hostTarget, uint16_t port, uint16_t txtLen, const unsigned char *txtRecord, void *context) _CUPS_NONNULL(1,5,6,9, 10);
-#elif defined(HAVE_AVAHI)
-static int             poll_callback(struct pollfd *pollfds,
-                                     unsigned int num_pollfds, int timeout,
-                                     void *context);
-static void            resolve_callback(AvahiServiceResolver *res,
-                                        AvahiIfIndex interface,
-                                        AvahiProtocol protocol,
-                                        AvahiResolverEvent event,
-                                        const char *serviceName,
-                                        const char *regtype,
-                                        const char *replyDomain,
-                                        const char *host_name,
-                                        const AvahiAddress *address,
-                                        uint16_t port,
-                                        AvahiStringList *txt,
-                                        AvahiLookupResultFlags flags,
-                                        void *context);
-#endif /* HAVE_MDNSRESPONDER */
+static ippfind_expr_t  *new_expr(ippfind_op_t op, bool invert, const char *value, const char *regex, char **args);
+static void            resolve_callback(cups_dnssd_resolve_t *resolve, void *context, cups_dnssd_flags_t flags, uint32_t if_index, const char *fullName, const char *hostTarget, uint16_t port, size_t num_txt, cups_option_t *txt);
 static void            set_service_uri(ippfind_srv_t *service);
 static void            show_usage(void) _CUPS_NORETURN;
 static void            show_version(void) _CUPS_NORETURN;
+#if _WIN32
+static char            *win32_escape_dup(const char *s);
+#endif // _WIN32
 
 
-/*
- * 'main()' - Browse for printers.
- */
+//
+// 'main()' - Browse for printers.
+//
 
-int                                    /* O - Exit status */
-main(int  argc,                                /* I - Number of command-line args */
-     char *argv[])                     /* I - Command-line arguments */
+int                                    // O - Exit status
+main(int  argc,                                // I - Number of command-line args
+     char *argv[])                     // I - Command-line arguments
 {
-  int                  i,              /* Looping var */
-                       have_output = 0,/* Have output expression */
+  int                  i,              // Looping var
+                       have_output = 0,// Have output expression
                        status = IPPFIND_EXIT_FALSE;
-                                       /* Exit status */
-  const char           *opt,           /* Option character */
-                       *search;        /* Current browse/resolve string */
-  cups_array_t         *searches;      /* Things to browse/resolve */
-  cups_array_t         *services;      /* Service array */
-  ippfind_srv_t                *service;       /* Current service */
+                                       // Exit status
+  const char           *opt,           // Option character
+                       *search;        // Current browse/resolve string
+  cups_array_t         *searches;      // Things to browse/resolve
+  ippfind_srvs_t       services;       // Services array
+  ippfind_srv_t                *service;       // Current service
   ippfind_expr_t       *expressions = NULL,
-                                       /* Expression tree */
-                       *temp = NULL,   /* New expression */
-                       *parent = NULL, /* Parent expression */
-                       *current = NULL,/* Current expression */
-                       *parens[100];   /* Markers for parenthesis */
-  int                  num_parens = 0; /* Number of parenthesis */
+                                       // Expression tree
+                       *temp = NULL,   // New expression
+                       *parent = NULL, // Parent expression
+                       *current = NULL,// Current expression
+                       *parens[100];   // Markers for parenthesis
+  int                  num_parens = 0; // Number of parenthesis
   ippfind_op_t         logic = IPPFIND_OP_AND;
-                                       /* Logic for next expression */
-  int                  invert = 0;     /* Invert expression? */
-  int                  err;            /* DNS-SD error */
-#ifdef HAVE_MDNSRESPONDER
-  fd_set               sinput;         /* Input set for select() */
-  struct timeval       stimeout;       /* Timeout for select() */
-#endif /* HAVE_MDNSRESPONDER */
-  double               endtime;        /* End time */
-  static const char * const ops[] =    /* Node operation names */
+                                       // Logic for next expression
+  int                  invert = 0;     // Invert expression?
+  double               endtime;        // End time
+  static const char * const ops[] =    // Node operation names
   {
     "NONE",
     "AND",
@@ -259,26 +196,21 @@ main(int  argc,                           /* I - Number of command-line args */
   };
 
 
- /*
-  * Initialize the locale...
-  */
-
+  // Initialize the locale...
   _cupsSetLocale(argv);
 
- /*
-  * Create arrays to track services and things we want to browse/resolve...
-  */
+  // Create arrays to track services and things we want to browse/resolve...
+  searches = cupsArrayNew3(NULL, NULL, NULL, 0, NULL, NULL);
 
-  searches = cupsArrayNew(NULL, NULL);
-  services = cupsArrayNew((cups_array_func_t)compare_services, NULL);
-
- /*
-  * Parse command-line...
-  */
+  cupsRWInit(&services.rwlock);
+  services.services = cupsArrayNew3((cups_array_cb_t)compare_services, NULL, NULL, 0, NULL, NULL);
 
+  // Parse command-line...
   if (getenv("IPPFIND_DEBUG"))
+  {
     for (i = 1; i < argc; i ++)
       fprintf(stderr, "argv[%d]=\"%s\"\n", i, argv[i]);
+  }
 
   for (i = 1; i < argc; i ++)
   {
@@ -286,10 +218,7 @@ main(int  argc,                            /* I - Number of command-line args */
     {
       if (argv[i][1] == '-')
       {
-       /*
-        * Parse --option options...
-        */
-
+        // Parse --option options...
         if (!strcmp(argv[i], "--and"))
         {
           if (logic == IPPFIND_OP_OR)
@@ -320,7 +249,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_DOMAIN_REGEX, invert, NULL, argv[i],
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--exec"))
         {
@@ -334,7 +263,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_EXEC, invert, NULL, NULL,
                                argv + i)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
 
           while (i < argc)
             if (!strcmp(argv[i], ";"))
@@ -355,7 +284,7 @@ main(int  argc,                             /* I - Number of command-line args */
         {
           if ((temp = new_expr(IPPFIND_OP_FALSE, invert, NULL, NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--help"))
         {
@@ -374,13 +303,13 @@ main(int  argc,                           /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_HOST_REGEX, invert, NULL, argv[i],
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--ls"))
         {
           if ((temp = new_expr(IPPFIND_OP_LIST, invert, NULL, NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
 
           have_output = 1;
         }
@@ -388,7 +317,7 @@ main(int  argc,                             /* I - Number of command-line args */
         {
           if ((temp = new_expr(IPPFIND_OP_IS_LOCAL, invert, NULL, NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--literal-name"))
         {
@@ -400,7 +329,7 @@ main(int  argc,                             /* I - Number of command-line args */
           }
 
           if ((temp = new_expr(IPPFIND_OP_NAME_LITERAL, invert, argv[i], NULL, NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--name"))
         {
@@ -415,7 +344,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_NAME_REGEX, invert, NULL, argv[i],
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--not"))
         {
@@ -434,30 +363,20 @@ main(int  argc,                           /* I - Number of command-line args */
 
           if (parent && parent->op == IPPFIND_OP_OR)
           {
-           /*
-            * Already setup to do "foo --or bar --or baz"...
-            */
-
+            // Already setup to do "foo --or bar --or baz"...
             temp = NULL;
           }
           else if (!current->prev && parent)
           {
-           /*
-            * Change parent node into an OR node...
-            */
-
+            // Change parent node into an OR node...
             parent->op = IPPFIND_OP_OR;
             temp       = NULL;
           }
           else if (!current->prev)
           {
-           /*
-            * Need to group "current" in a new OR node...
-            */
-
-           if ((temp = new_expr(IPPFIND_OP_OR, 0, NULL, NULL,
-                                NULL)) == NULL)
-             return (IPPFIND_EXIT_MEMORY);
+            // Need to group "current" in a new OR node...
+           if ((temp = new_expr(IPPFIND_OP_OR, 0, NULL, NULL, NULL)) == NULL)
+             exit(IPPFIND_EXIT_MEMORY);
 
             temp->parent    = parent;
             temp->child     = current;
@@ -473,14 +392,9 @@ main(int  argc,                            /* I - Number of command-line args */
          }
          else
          {
-          /*
-           * Need to group previous expressions in an AND node, and then
-           * put that in an OR node...
-           */
-
-           if ((temp = new_expr(IPPFIND_OP_AND, 0, NULL, NULL,
-                                NULL)) == NULL)
-             return (IPPFIND_EXIT_MEMORY);
+           // Need to group previous expressions in an AND node, and then put that in an OR node...
+           if ((temp = new_expr(IPPFIND_OP_AND, 0, NULL, NULL, NULL)) == NULL)
+             exit(IPPFIND_EXIT_MEMORY);
 
            while (current->prev)
            {
@@ -492,9 +406,8 @@ main(int  argc,                             /* I - Number of command-line args */
            temp->child     = current;
            current         = temp;
 
-           if ((temp = new_expr(IPPFIND_OP_OR, 0, NULL, NULL,
-                                NULL)) == NULL)
-             return (IPPFIND_EXIT_MEMORY);
+           if ((temp = new_expr(IPPFIND_OP_OR, 0, NULL, NULL, NULL)) == NULL)
+             exit(IPPFIND_EXIT_MEMORY);
 
             temp->parent    = parent;
             current->parent = temp;
@@ -521,7 +434,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_PATH_REGEX, invert, NULL, argv[i],
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--port"))
         {
@@ -536,13 +449,13 @@ main(int  argc,                           /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_PORT_RANGE, invert, argv[i], NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--print"))
         {
           if ((temp = new_expr(IPPFIND_OP_PRINT_URI, invert, NULL, NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
 
           have_output = 1;
         }
@@ -550,7 +463,7 @@ main(int  argc,                             /* I - Number of command-line args */
         {
           if ((temp = new_expr(IPPFIND_OP_PRINT_NAME, invert, NULL, NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
 
           have_output = 1;
         }
@@ -558,7 +471,7 @@ main(int  argc,                             /* I - Number of command-line args */
         {
           if ((temp = new_expr(IPPFIND_OP_QUIET, invert, NULL, NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
 
           have_output = 1;
         }
@@ -566,13 +479,13 @@ main(int  argc,                           /* I - Number of command-line args */
         {
           if ((temp = new_expr(IPPFIND_OP_IS_REMOTE, invert, NULL, NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--true"))
         {
           if ((temp = new_expr(IPPFIND_OP_TRUE, invert, NULL, argv[i],
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--txt"))
         {
@@ -586,11 +499,11 @@ main(int  argc,                           /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_TXT_EXISTS, invert, argv[i], NULL,
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strncmp(argv[i], "--txt-", 6))
         {
-          const char *key = argv[i] + 6;/* TXT key */
+          const char *key = argv[i] + 6;// TXT key
 
           i ++;
           if (i >= argc)
@@ -603,7 +516,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_TXT_REGEX, invert, key, argv[i],
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--uri"))
         {
@@ -618,7 +531,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
           if ((temp = new_expr(IPPFIND_OP_URI_REGEX, invert, NULL, argv[i],
                                NULL)) == NULL)
-            return (IPPFIND_EXIT_MEMORY);
+            exit(IPPFIND_EXIT_MEMORY);
         }
         else if (!strcmp(argv[i], "--version"))
         {
@@ -633,46 +546,28 @@ main(int  argc,                           /* I - Number of command-line args */
 
         if (temp)
         {
-         /*
-          * Add new expression...
-          */
-
-         if (logic == IPPFIND_OP_AND &&
-             current && current->prev &&
-             parent && parent->op != IPPFIND_OP_AND)
+          // Add new expression...
+         if (logic == IPPFIND_OP_AND && current && current->prev && parent && parent->op != IPPFIND_OP_AND)
           {
-           /*
-            * Need to re-group "current" in a new AND node...
-            */
-
-            ippfind_expr_t *tempand;   /* Temporary AND node */
-
-           if ((tempand = new_expr(IPPFIND_OP_AND, 0, NULL, NULL,
-                                   NULL)) == NULL)
-             return (IPPFIND_EXIT_MEMORY);
+            // Need to re-group "current" in a new AND node...
+            ippfind_expr_t *tempand;   // Temporary AND node
 
-           /*
-            * Replace "current" with new AND node at the end of this list...
-            */
+           if ((tempand = new_expr(IPPFIND_OP_AND, 0, NULL, NULL, NULL)) == NULL)
+             exit(IPPFIND_EXIT_MEMORY);
 
+            // Replace "current" with new AND node at the end of this list...
             current->prev->next = tempand;
             tempand->prev       = current->prev;
             tempand->parent     = parent;
 
-           /*
-            * Add "current to the new AND node...
-            */
-
+            // Add "current to the new AND node...
             tempand->child  = current;
             current->parent = tempand;
             current->prev   = NULL;
            parent          = tempand;
          }
 
-         /*
-          * Add the new node at current level...
-          */
-
+          // Add the new node at current level...
          temp->parent = parent;
          temp->prev   = current;
 
@@ -691,10 +586,7 @@ main(int  argc,                            /* I - Number of command-line args */
       }
       else
       {
-       /*
-        * Parse -o options
-        */
-
+        // Parse -o options
         for (opt = argv[i] + 1; *opt; opt ++)
         {
           switch (*opt)
@@ -707,7 +599,7 @@ main(int  argc,                             /* I - Number of command-line args */
                 address_family = AF_INET6;
                 break;
 
-            case 'N' : /* Literal name */
+            case 'N' : // Literal name
                i ++;
                if (i >= argc)
                {
@@ -716,7 +608,7 @@ main(int  argc,                             /* I - Number of command-line args */
                }
 
                if ((temp = new_expr(IPPFIND_OP_NAME_LITERAL, invert, argv[i], NULL, NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                break;
 
             case 'P' :
@@ -731,7 +623,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
                if ((temp = new_expr(IPPFIND_OP_PORT_RANGE, invert, argv[i],
                                     NULL, NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                break;
 
             case 'T' :
@@ -785,7 +677,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
                if ((temp = new_expr(IPPFIND_OP_DOMAIN_REGEX, invert, NULL,
                                     argv[i], NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                 break;
 
             case 'h' :
@@ -800,13 +692,13 @@ main(int  argc,                           /* I - Number of command-line args */
 
                if ((temp = new_expr(IPPFIND_OP_HOST_REGEX, invert, NULL,
                                     argv[i], NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                 break;
 
             case 'l' :
                if ((temp = new_expr(IPPFIND_OP_LIST, invert, NULL, NULL,
                                     NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
 
                have_output = 1;
                 break;
@@ -823,13 +715,13 @@ main(int  argc,                           /* I - Number of command-line args */
 
                if ((temp = new_expr(IPPFIND_OP_NAME_REGEX, invert, NULL,
                                     argv[i], NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                 break;
 
             case 'p' :
                if ((temp = new_expr(IPPFIND_OP_PRINT_URI, invert, NULL, NULL,
                                     NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
 
                have_output = 1;
                 break;
@@ -837,7 +729,7 @@ main(int  argc,                             /* I - Number of command-line args */
             case 'q' :
                if ((temp = new_expr(IPPFIND_OP_QUIET, invert, NULL, NULL,
                                     NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
 
                have_output = 1;
                 break;
@@ -845,13 +737,13 @@ main(int  argc,                           /* I - Number of command-line args */
             case 'r' :
                if ((temp = new_expr(IPPFIND_OP_IS_REMOTE, invert, NULL, NULL,
                                     NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                 break;
 
             case 's' :
                if ((temp = new_expr(IPPFIND_OP_PRINT_NAME, invert, NULL, NULL,
                                     NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
 
                have_output = 1;
                 break;
@@ -868,7 +760,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
                if ((temp = new_expr(IPPFIND_OP_TXT_EXISTS, invert, argv[i],
                                     NULL, NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                 break;
 
             case 'u' :
@@ -883,7 +775,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
                if ((temp = new_expr(IPPFIND_OP_URI_REGEX, invert, NULL,
                                     argv[i], NULL)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
                 break;
 
             case 'x' :
@@ -898,7 +790,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
                if ((temp = new_expr(IPPFIND_OP_EXEC, invert, NULL, NULL,
                                     argv + i)) == NULL)
-                 return (IPPFIND_EXIT_MEMORY);
+                 exit(IPPFIND_EXIT_MEMORY);
 
                while (i < argc)
                  if (!strcmp(argv[i], ";"))
@@ -925,46 +817,28 @@ main(int  argc,                           /* I - Number of command-line args */
 
          if (temp)
          {
-          /*
-           * Add new expression...
-           */
-
-           if (logic == IPPFIND_OP_AND &&
-               current && current->prev &&
-               parent && parent->op != IPPFIND_OP_AND)
+           // Add new expression...
+           if (logic == IPPFIND_OP_AND && current && current->prev && parent && parent->op != IPPFIND_OP_AND)
            {
-            /*
-             * Need to re-group "current" in a new AND node...
-             */
-
-             ippfind_expr_t *tempand;  /* Temporary AND node */
+             // Need to re-group "current" in a new AND node...
+             ippfind_expr_t *tempand;  // Temporary AND node
 
-             if ((tempand = new_expr(IPPFIND_OP_AND, 0, NULL, NULL,
-                                     NULL)) == NULL)
-               return (IPPFIND_EXIT_MEMORY);
-
-            /*
-             * Replace "current" with new AND node at the end of this list...
-             */
+             if ((tempand = new_expr(IPPFIND_OP_AND, 0, NULL, NULL, NULL)) == NULL)
+               exit(IPPFIND_EXIT_MEMORY);
 
+             // Replace "current" with new AND node at the end of this list...
              current->prev->next = tempand;
              tempand->prev       = current->prev;
              tempand->parent     = parent;
 
-            /*
-             * Add "current to the new AND node...
-             */
-
+             // Add "current to the new AND node...
              tempand->child  = current;
              current->parent = tempand;
              current->prev   = NULL;
              parent          = tempand;
            }
 
-          /*
-           * Add the new node at current level...
-           */
-
+           // Add the new node at current level...
            temp->parent = parent;
            temp->prev   = current;
 
@@ -992,7 +866,7 @@ main(int  argc,                             /* I - Number of command-line args */
       }
 
       if ((temp = new_expr(IPPFIND_OP_AND, invert, NULL, NULL, NULL)) == NULL)
-       return (IPPFIND_EXIT_MEMORY);
+       exit(IPPFIND_EXIT_MEMORY);
 
       parens[num_parens++] = temp;
 
@@ -1029,14 +903,11 @@ main(int  argc,                          /* I - Number of command-line args */
     }
     else
     {
-     /*
-      * _regtype._tcp[,subtype][.domain]
-      *
-      *   OR
-      *
-      * service-name[._regtype._tcp[.domain]]
-      */
-
+      // _regtype._tcp[,subtype][.domain]
+      //
+      // OR
+      //
+      // service-name[._regtype._tcp[.domain]]
       cupsArrayAdd(searches, argv[i]);
     }
   }
@@ -1049,12 +920,9 @@ main(int  argc,                           /* I - Number of command-line args */
 
   if (!have_output)
   {
-   /*
-    * Add an implicit --print-uri to the end...
-    */
-
+    // Add an implicit --print-uri to the end...
     if ((temp = new_expr(IPPFIND_OP_PRINT_URI, 0, NULL, NULL, NULL)) == NULL)
-      return (IPPFIND_EXIT_MEMORY);
+      exit(IPPFIND_EXIT_MEMORY);
 
     if (current)
     {
@@ -1068,41 +936,33 @@ main(int  argc,                          /* I - Number of command-line args */
       expressions = temp;
   }
 
-  if (cupsArrayCount(searches) == 0)
+  if (cupsArrayGetCount(searches) == 0)
   {
-   /*
-    * Add an implicit browse for IPP printers ("_ipp._tcp")...
-    */
-
+    // Add an implicit browse for IPP printers ("_ipp._tcp")...
     cupsArrayAdd(searches, "_ipp._tcp");
   }
 
   if (getenv("IPPFIND_DEBUG"))
   {
-    int                indent = 4;             /* Indentation */
+    int                indent = 4;             // Indentation
 
     puts("Expression tree:");
     current = expressions;
     while (current)
     {
-     /*
-      * Print the current node...
-      */
-
-      printf("%*s%s%s\n", indent, "", current->invert ? "!" : "",
-             ops[current->op]);
-
-     /*
-      * Advance to the next node...
-      */
+      // Print the current node...
+      printf("%*s%s%s\n", indent, "", current->invert ? "!" : "", ops[current->op]);
 
+      // Advance to the next node...
       if (current->child)
       {
         current = current->child;
         indent += 4;
       }
       else if (current->next)
+      {
         current = current->next;
+      }
       else if (current->parent)
       {
         while (current->parent)
@@ -1116,56 +976,26 @@ main(int  argc,                          /* I - Number of command-line args */
         current = current->next;
       }
       else
+      {
         current = NULL;
+      }
     }
 
     puts("\nSearch items:");
-    for (search = (const char *)cupsArrayFirst(searches);
-        search;
-        search = (const char *)cupsArrayNext(searches))
+    for (search = (const char *)cupsArrayGetFirst(searches); search; search = (const char *)cupsArrayGetNext(searches))
       printf("    %s\n", search);
   }
 
- /*
-  * Start up browsing/resolving...
-  */
-
-#ifdef HAVE_MDNSRESPONDER
-  if ((err = DNSServiceCreateConnection(&dnssd_ref)) != kDNSServiceErr_NoError)
-  {
-    _cupsLangPrintf(stderr, _("ippfind: Unable to use Bonjour: %s"),
-                    dnssd_error_string(err));
-    return (IPPFIND_EXIT_BONJOUR);
-  }
-
-#elif defined(HAVE_AVAHI)
-  if ((avahi_poll = avahi_simple_poll_new()) == NULL)
-  {
-    _cupsLangPrintf(stderr, _("ippfind: Unable to use Bonjour: %s"),
-                    strerror(errno));
-    return (IPPFIND_EXIT_BONJOUR);
-  }
-
-  avahi_simple_poll_set_func(avahi_poll, poll_callback, NULL);
+  // Start up browsing/resolving...
+  if ((dnssd = cupsDNSSDNew(NULL, NULL)) == NULL)
+    exit(IPPFIND_EXIT_BONJOUR);
 
-  avahi_client = avahi_client_new(avahi_simple_poll_get(avahi_poll),
-                                 0, client_callback, avahi_poll, &err);
-  if (!avahi_client)
+  for (search = (const char *)cupsArrayGetFirst(searches); search; search = (const char *)cupsArrayGetNext(searches))
   {
-    _cupsLangPrintf(stderr, _("ippfind: Unable to use Bonjour: %s"),
-                    dnssd_error_string(err));
-    return (IPPFIND_EXIT_BONJOUR);
-  }
-#endif /* HAVE_MDNSRESPONDER */
-
-  for (search = (const char *)cupsArrayFirst(searches);
-       search;
-       search = (const char *)cupsArrayNext(searches))
-  {
-    char               buf[1024],      /* Full name string */
-                       *name = NULL,   /* Service instance name */
-                       *regtype,       /* Registration type */
-                       *domain;        /* Domain, if any */
+    char       buf[1024],              // Full name string
+               *name = NULL,           // Service instance name
+               *regtype,               // Registration type
+               *domain;                // Domain, if any
 
     cupsCopyString(buf, search, sizeof(buf));
 
@@ -1177,30 +1007,20 @@ main(int  argc,                         /* I - Number of command-line args */
     {
       if (strcmp(regtype, "._tcp"))
       {
-       /*
-        * "something._protocol._tcp" -> search for something with the given
-        * protocol...
-        */
-
+        // "something._protocol._tcp" -> search for something with the given protocol...
        name = buf;
        *regtype++ = '\0';
       }
       else
       {
-       /*
-        * "_protocol._tcp" -> search for everything with the given protocol...
-        */
-
-        /* name = NULL; */
+        // "_protocol._tcp" -> search for everything with the given protocol...
+        // name = NULL;
         regtype = buf;
       }
     }
     else
     {
-     /*
-      * "something" -> search for something with IPP protocol...
-      */
-
+      // "something" -> search for something with IPP protocol...
       name    = buf;
       regtype = "_ipp._tcp";
     }
@@ -1219,94 +1039,30 @@ main(int  argc,                         /* I - Number of command-line args */
 
     if (name)
     {
-     /*
-      * Resolve the given service instance name, regtype, and domain...
-      */
-
+      // Resolve the given service instance name, regtype, and domain...
       if (!domain)
         domain = "local.";
 
-      service = get_service(services, name, regtype, domain);
+      service = get_service(&services, name, regtype, domain);
 
       if (getenv("IPPFIND_DEBUG"))
         fprintf(stderr, "Resolving name=\"%s\", regtype=\"%s\", domain=\"%s\"\n", name, regtype, domain);
 
-#ifdef HAVE_MDNSRESPONDER
-      service->ref = dnssd_ref;
-      err          = DNSServiceResolve(&(service->ref),
-                                       kDNSServiceFlagsShareConnection, 0, name,
-                                      regtype, domain, resolve_callback,
-                                      service);
-
-#elif defined(HAVE_AVAHI)
-      service->ref = avahi_service_resolver_new(avahi_client, AVAHI_IF_UNSPEC,
-                                                AVAHI_PROTO_UNSPEC, name,
-                                                regtype, domain,
-                                                AVAHI_PROTO_UNSPEC, 0,
-                                                resolve_callback, service);
-      if (service->ref)
-        err = 0;
-      else
-        err = avahi_client_errno(avahi_client);
-#endif /* HAVE_MDNSRESPONDER */
+      if ((service->resolve = cupsDNSSDResolveNew(dnssd, CUPS_DNSSD_IF_INDEX_ANY, name, regtype, domain, resolve_callback, service)) == NULL)
+        exit(IPPFIND_EXIT_BONJOUR);
     }
     else
     {
-     /*
-      * Browse for services of the given type...
-      */
-
+      // Browse for services of the given type...
       if (getenv("IPPFIND_DEBUG"))
         fprintf(stderr, "Browsing for regtype=\"%s\", domain=\"%s\"\n", regtype, domain);
 
-#ifdef HAVE_MDNSRESPONDER
-      DNSServiceRef    ref;            /* Browse reference */
-
-      ref = dnssd_ref;
-      err = DNSServiceBrowse(&ref, kDNSServiceFlagsShareConnection, 0, regtype,
-                             domain, browse_callback, services);
-
-      if (!err)
-      {
-       ref = dnssd_ref;
-       err = DNSServiceBrowse(&ref, kDNSServiceFlagsShareConnection,
-                              kDNSServiceInterfaceIndexLocalOnly, regtype,
-                              domain, browse_local_callback, services);
-      }
-
-#elif defined(HAVE_AVAHI)
-      char     *subtype,               /* Sub-type, if any */
-               subtype_buf[256];       /* Sub-type buffer */
-
-      if ((subtype = strstr(regtype, ",_")) != NULL)
-      {
-        *subtype++ = '\0';
-        snprintf(subtype_buf, sizeof(subtype_buf), "%s._sub.%s", subtype, regtype);
-        regtype = subtype_buf;
-      }
-
-      if (avahi_service_browser_new(avahi_client, AVAHI_IF_UNSPEC,
-                                    AVAHI_PROTO_UNSPEC, regtype, domain, 0,
-                                    browse_callback, services))
-        err = 0;
-      else
-        err = avahi_client_errno(avahi_client);
-#endif /* HAVE_MDNSRESPONDER */
-    }
-
-    if (err)
-    {
-      _cupsLangPrintf(stderr, _("ippfind: Unable to browse or resolve: %s"),
-                      dnssd_error_string(err));
-
-      return (IPPFIND_EXIT_BONJOUR);
+      if (!cupsDNSSDBrowseNew(dnssd, CUPS_DNSSD_IF_INDEX_ANY, regtype, domain, browse_callback, &services))
+       exit(IPPFIND_EXIT_BONJOUR);
     }
   }
 
- /*
-  * Process browse/resolve requests...
-  */
-
+  // Process browse/resolve requests...
   if (bonjour_timeout > 1.0)
     endtime = get_time() + bonjour_timeout;
   else
@@ -1314,464 +1070,132 @@ main(int  argc,                               /* I - Number of command-line args */
 
   while (get_time() < endtime)
   {
-    int                process = 0;            /* Process services? */
-
-#ifdef HAVE_MDNSRESPONDER
-    int fd = DNSServiceRefSockFD(dnssd_ref);
-                                       /* File descriptor for DNS-SD */
-
-    FD_ZERO(&sinput);
-    FD_SET(fd, &sinput);
-
-    stimeout.tv_sec  = 0;
-    stimeout.tv_usec = 500000;
-
-    if (select(fd + 1, &sinput, NULL, NULL, &stimeout) < 0)
-      continue;
-
-    if (FD_ISSET(fd, &sinput))
-    {
-     /*
-      * Process responses...
-      */
-
-      DNSServiceProcessResult(dnssd_ref);
-    }
-    else
+    // Process any services that we have found...
+    size_t     j,                      // Looping var
+               count,                  // Number of services
+               active = 0,             // Number of active resolves
+               resolved = 0,           // Number of resolved services
+               processed = 0;          // Number of processed services
+
+    cupsRWLockRead(&services.rwlock);
+    for (j = 0, count = cupsArrayGetCount(services.services); j < count; j ++)
     {
-     /*
-      * Time to process services...
-      */
-
-      process = 1;
-    }
-
-#elif defined(HAVE_AVAHI)
-    avahi_got_data = 0;
-
-    if (avahi_simple_poll_iterate(avahi_poll, 500) > 0)
-    {
-     /*
-      * We've been told to exit the loop.  Perhaps the connection to
-      * Avahi failed.
-      */
-
-      return (IPPFIND_EXIT_BONJOUR);
-    }
-
-    if (!avahi_got_data)
-    {
-     /*
-      * Time to process services...
-      */
-
-      process = 1;
-    }
-#endif /* HAVE_MDNSRESPONDER */
+      service = (ippfind_srv_t *)cupsArrayGetElement(services.services, j);
 
-    if (process)
-    {
-     /*
-      * Process any services that we have found...
-      */
+      if (service->is_processed)
+       processed ++;
 
-      int      active = 0,             /* Number of active resolves */
-               processed = 0;          /* Number of processed services */
+      if (service->is_resolved)
+       resolved ++;
 
-      for (service = (ippfind_srv_t *)cupsArrayFirst(services);
-           service;
-           service = (ippfind_srv_t *)cupsArrayNext(services))
+      if (!service->resolve && !service->is_resolved)
       {
-        if (service->is_processed)
-          processed ++;
-
-        if (!service->ref && !service->is_resolved)
-        {
-         /*
-          * Found a service, now resolve it (but limit to 50 active resolves...)
-          */
-
-          if (active < 50)
-          {
-#ifdef HAVE_MDNSRESPONDER
-           service->ref = dnssd_ref;
-           err          = DNSServiceResolve(&(service->ref),
-                                            kDNSServiceFlagsShareConnection, 0,
-                                            service->name, service->regtype,
-                                            service->domain, resolve_callback,
-                                            service);
-
-#elif defined(HAVE_AVAHI)
-           service->ref = avahi_service_resolver_new(avahi_client,
-                                                     AVAHI_IF_UNSPEC,
-                                                     AVAHI_PROTO_UNSPEC,
-                                                     service->name,
-                                                     service->regtype,
-                                                     service->domain,
-                                                     AVAHI_PROTO_UNSPEC, 0,
-                                                     resolve_callback,
-                                                     service);
-           if (service->ref)
-             err = 0;
-           else
-             err = avahi_client_errno(avahi_client);
-#endif /* HAVE_MDNSRESPONDER */
-
-           if (err)
-           {
-             _cupsLangPrintf(stderr,
-                             _("ippfind: Unable to browse or resolve: %s"),
-                             dnssd_error_string(err));
-             return (IPPFIND_EXIT_BONJOUR);
-           }
-
-           active ++;
-          }
-        }
-        else if (service->is_resolved && !service->is_processed)
-        {
-        /*
-         * Resolved, not process this service against the expressions...
-         */
+        // Found a service, now resolve it (but limit to 50 active resolves...)
+       if (active < 50)
+       {
+         if ((service->resolve = cupsDNSSDResolveNew(dnssd, CUPS_DNSSD_IF_INDEX_ANY, service->name, service->regtype, service->domain, resolve_callback, service)) == NULL)
+           exit(IPPFIND_EXIT_BONJOUR);
 
-          if (service->ref)
-          {
-#ifdef HAVE_MDNSRESPONDER
-           DNSServiceRefDeallocate(service->ref);
-#else
-            avahi_service_resolver_free(service->ref);
-#endif /* HAVE_MDNSRESPONDER */
+         active ++;
+       }
+      }
+      else if (service->is_resolved && !service->is_processed)
+      {
+        // Resolved, not process this service against the expressions...
+       cupsDNSSDResolveDelete(service->resolve);
+       service->resolve = NULL;
 
-           service->ref = NULL;
-         }
+        if (getenv("IPPFIND_DEBUG"))
+          fprintf(stderr, "EVAL %s\n", service->uri);
 
-          if (eval_expr(service, expressions))
-            status = IPPFIND_EXIT_TRUE;
+       if (eval_expr(service, expressions))
+         status = IPPFIND_EXIT_TRUE;
 
-          service->is_processed = 1;
-        }
-        else if (service->ref)
-          active ++;
+       service->is_processed = true;
       }
+      else if (service->resolve)
+       active ++;
+    }
+    cupsRWUnlock(&services.rwlock);
 
-     /*
-      * If we have processed all services we have discovered, then we are done.
-      */
+    // If we have processed all services we have discovered, then we are done.
+    if (getenv("IPPFIND_DEBUG"))
+      fprintf(stderr, "STATUS processed=%u, resolved=%u, count=%u\n", (unsigned)processed, (unsigned)resolved, (unsigned)count);
 
-      if (processed == cupsArrayCount(services) && bonjour_timeout <= 1.0)
-        break;
-    }
+    if (processed > 0 && processed == cupsArrayGetCount(services.services) && bonjour_timeout <= 1.0)
+      break;
+
+    // Give the browsers/resolvers some time...
+    usleep(250000);
   }
 
   if (bonjour_error)
-    return (IPPFIND_EXIT_BONJOUR);
+    exit(IPPFIND_EXIT_BONJOUR);
   else
-    return (status);
+    exit(status);
 }
 
 
-#ifdef HAVE_MDNSRESPONDER
-/*
- * 'browse_callback()' - Browse devices.
- */
-
-static void DNSSD_API
-browse_callback(
-    DNSServiceRef       sdRef,         /* I - Service reference */
-    DNSServiceFlags     flags,         /* I - Option flags */
-    uint32_t            interfaceIndex,        /* I - Interface number */
-    DNSServiceErrorType errorCode,     /* I - Error, if any */
-    const char          *serviceName,  /* I - Name of service/device */
-    const char          *regtype,      /* I - Type of service */
-    const char          *replyDomain,  /* I - Service domain */
-    void                *context)      /* I - Services array */
-{
- /*
-  * Only process "add" data...
-  */
-
-  (void)sdRef;
-  (void)interfaceIndex;
-
-  if (errorCode != kDNSServiceErr_NoError || !(flags & kDNSServiceFlagsAdd))
-    return;
-
- /*
-  * Get the device...
-  */
-
-  get_service((cups_array_t *)context, serviceName, regtype, replyDomain);
-}
-
-
-/*
- * 'browse_local_callback()' - Browse local devices.
- */
-
-static void DNSSD_API
-browse_local_callback(
-    DNSServiceRef       sdRef,         /* I - Service reference */
-    DNSServiceFlags     flags,         /* I - Option flags */
-    uint32_t            interfaceIndex,        /* I - Interface number */
-    DNSServiceErrorType errorCode,     /* I - Error, if any */
-    const char          *serviceName,  /* I - Name of service/device */
-    const char          *regtype,      /* I - Type of service */
-    const char          *replyDomain,  /* I - Service domain */
-    void                *context)      /* I - Services array */
-{
-  ippfind_srv_t        *service;               /* Service */
-
-
- /*
-  * Only process "add" data...
-  */
-
-  (void)sdRef;
-  (void)interfaceIndex;
-
-  if (errorCode != kDNSServiceErr_NoError || !(flags & kDNSServiceFlagsAdd))
-    return;
-
- /*
-  * Get the device...
-  */
-
-  service = get_service((cups_array_t *)context, serviceName, regtype,
-                        replyDomain);
-  service->is_local = 1;
-}
-#endif /* HAVE_MDNSRESPONDER */
-
-
-#ifdef HAVE_AVAHI
-/*
- * 'browse_callback()' - Browse devices.
- */
+//
+// 'browse_callback()' - Browse devices.
+//
 
 static void
 browse_callback(
-    AvahiServiceBrowser    *browser,   /* I - Browser */
-    AvahiIfIndex           interface,  /* I - Interface index (unused) */
-    AvahiProtocol          protocol,   /* I - Network protocol (unused) */
-    AvahiBrowserEvent      event,      /* I - What happened */
-    const char             *name,      /* I - Service name */
-    const char             *type,      /* I - Registration type */
-    const char             *domain,    /* I - Domain */
-    AvahiLookupResultFlags flags,      /* I - Flags */
-    void                   *context)   /* I - Services array */
-{
-  AvahiClient  *client = avahi_service_browser_get_client(browser);
-                                       /* Client information */
-  ippfind_srv_t        *service;               /* Service information */
-
-
-  (void)interface;
-  (void)protocol;
-  (void)context;
-
-  switch (event)
-  {
-    case AVAHI_BROWSER_FAILURE:
-       fprintf(stderr, "DEBUG: browse_callback: %s\n",
-               avahi_strerror(avahi_client_errno(client)));
-       bonjour_error = 1;
-       avahi_simple_poll_quit(avahi_poll);
-       break;
-
-    case AVAHI_BROWSER_NEW:
-       /*
-       * This object is new on the network. Create a device entry for it if
-       * it doesn't yet exist.
-       */
-
-       service = get_service((cups_array_t *)context, name, type, domain);
-
-       if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
-         service->is_local = 1;
-       break;
-
-    case AVAHI_BROWSER_REMOVE:
-    case AVAHI_BROWSER_ALL_FOR_NOW:
-    case AVAHI_BROWSER_CACHE_EXHAUSTED:
-        break;
-  }
-}
-
-
-/*
- * 'client_callback()' - Avahi client callback function.
- */
-
-static void
-client_callback(
-    AvahiClient      *client,          /* I - Client information (unused) */
-    AvahiClientState state,            /* I - Current state */
-    void             *context)         /* I - User data (unused) */
+    cups_dnssd_browse_t *browse,       // I - Browse request
+    void                *context,      // I - Services array
+    cups_dnssd_flags_t  flags,         // I - Flags
+    uint32_t            if_index,      // I - Interface
+    const char          *serviceName,  // I - Name of service/device
+    const char          *regtype,      // I - Type of service
+    const char          *replyDomain)  // I - Service domain
 {
-  (void)client;
-  (void)context;
-
- /*
-  * If the connection drops, quit.
-  */
+  ippfind_srv_t        *service;               // Service
 
-  if (state == AVAHI_CLIENT_FAILURE)
-  {
-    fputs("DEBUG: Avahi connection failed.\n", stderr);
-    bonjour_error = 1;
-    avahi_simple_poll_quit(avahi_poll);
-  }
-}
-#endif /* HAVE_AVAHI */
+  if (getenv("IPPFIND_DEBUG"))
+    fprintf(stderr, "B flags=0x%04X, if_index=%u, serviceName=\"%s\", regtype=\"%s\", replyDomain=\"%s\"\n", flags, if_index, serviceName, regtype, replyDomain);
 
+  (void)browse;
 
-/*
- * 'compare_services()' - Compare two devices.
- */
+  // Only process "add" data...
+  if ((flags & CUPS_DNSSD_FLAGS_ERROR) || !(flags & CUPS_DNSSD_FLAGS_ADD))
+    return;
 
-static int                             /* O - Result of comparison */
-compare_services(ippfind_srv_t *a,     /* I - First device */
-                 ippfind_srv_t *b)     /* I - Second device */
-{
-  return (strcmp(a->name, b->name));
+  // Get the device...
+  service = get_service((ippfind_srvs_t *)context, serviceName, regtype, replyDomain);
+  if (if_index == CUPS_DNSSD_IF_INDEX_LOCAL)
+    service->is_local = 1;
 }
 
 
-/*
- * 'dnssd_error_string()' - Return an error string for an error code.
- */
+//
+// 'compare_services()' - Compare two devices.
+//
 
-static const char *                    /* O - Error message */
-dnssd_error_string(int error)          /* I - Error number */
+static int                             // O - Result of comparison
+compare_services(ippfind_srv_t *a,     // I - First device
+                 ippfind_srv_t *b)     // I - Second device
 {
-#  ifdef HAVE_MDNSRESPONDER
-  switch (error)
-  {
-    case kDNSServiceErr_NoError :
-        return ("OK.");
-
-    default :
-    case kDNSServiceErr_Unknown :
-        return ("Unknown error.");
-
-    case kDNSServiceErr_NoSuchName :
-        return ("Service not found.");
-
-    case kDNSServiceErr_NoMemory :
-        return ("Out of memory.");
-
-    case kDNSServiceErr_BadParam :
-        return ("Bad parameter.");
-
-    case kDNSServiceErr_BadReference :
-        return ("Bad service reference.");
-
-    case kDNSServiceErr_BadState :
-        return ("Bad state.");
-
-    case kDNSServiceErr_BadFlags :
-        return ("Bad flags.");
-
-    case kDNSServiceErr_Unsupported :
-        return ("Unsupported.");
-
-    case kDNSServiceErr_NotInitialized :
-        return ("Not initialized.");
-
-    case kDNSServiceErr_AlreadyRegistered :
-        return ("Already registered.");
-
-    case kDNSServiceErr_NameConflict :
-        return ("Name conflict.");
-
-    case kDNSServiceErr_Invalid :
-        return ("Invalid name.");
-
-    case kDNSServiceErr_Firewall :
-        return ("Firewall prevents registration.");
-
-    case kDNSServiceErr_Incompatible :
-        return ("Client library incompatible.");
-
-    case kDNSServiceErr_BadInterfaceIndex :
-        return ("Bad interface index.");
-
-    case kDNSServiceErr_Refused :
-        return ("Server prevents registration.");
-
-    case kDNSServiceErr_NoSuchRecord :
-        return ("Record not found.");
-
-    case kDNSServiceErr_NoAuth :
-        return ("Authentication required.");
-
-    case kDNSServiceErr_NoSuchKey :
-        return ("Encryption key not found.");
-
-    case kDNSServiceErr_NATTraversal :
-        return ("Unable to traverse NAT boundary.");
-
-    case kDNSServiceErr_DoubleNAT :
-        return ("Unable to traverse double-NAT boundary.");
-
-    case kDNSServiceErr_BadTime :
-        return ("Bad system time.");
-
-    case kDNSServiceErr_BadSig :
-        return ("Bad signature.");
-
-    case kDNSServiceErr_BadKey :
-        return ("Bad encryption key.");
-
-    case kDNSServiceErr_Transient :
-        return ("Transient error occurred - please try again.");
-
-    case kDNSServiceErr_ServiceNotRunning :
-        return ("Server not running.");
-
-    case kDNSServiceErr_NATPortMappingUnsupported :
-        return ("NAT doesn't support NAT-PMP or UPnP.");
-
-    case kDNSServiceErr_NATPortMappingDisabled :
-        return ("NAT supports NAT-PNP or UPnP but it is disabled.");
-
-    case kDNSServiceErr_NoRouter :
-        return ("No Internet/default router configured.");
-
-    case kDNSServiceErr_PollingMode :
-        return ("Service polling mode error.");
-
-#ifndef _WIN32
-    case kDNSServiceErr_Timeout :
-        return ("Service timeout.");
-#endif /* !_WIN32 */
-  }
-
-#  elif defined(HAVE_AVAHI)
-  return (avahi_strerror(error));
-#  endif /* HAVE_MDNSRESPONDER */
+  return (_cups_strcasecmp(a->name, b->name));
 }
 
 
-/*
- * 'eval_expr()' - Evaluate the expressions against the specified service.
- *
- * Returns 1 for true and 0 for false.
- */
+//
+// 'eval_expr()' - Evaluate the expressions against the specified service.
+//
+// Returns 1 for true and 0 for false.
+//
 
-static int                             /* O - Result of evaluation */
-eval_expr(ippfind_srv_t  *service,     /* I - Service */
-         ippfind_expr_t *expressions)  /* I - Expressions */
+static int                             // O - Result of evaluation
+eval_expr(ippfind_srv_t  *service,     // I - Service
+         ippfind_expr_t *expressions)  // I - Expressions
 {
-  ippfind_op_t         logic;          /* Logical operation */
-  int                  result;         /* Result of current expression */
-  ippfind_expr_t       *expression;    /* Current expression */
-  const char           *val;           /* TXT value */
-
- /*
-  * Loop through the expressions...
-  */
+  ippfind_op_t         logic;          // Logical operation
+  int                  result;         // Result of current expression
+  ippfind_expr_t       *expression;    // Current expression
+  const char           *val;           // TXT value
 
+  // Loop through the expressions...
   if (expressions && expressions->parent)
     logic = expressions->parent->op;
   else
@@ -1821,12 +1245,10 @@ eval_expr(ippfind_srv_t  *service,      /* I - Service */
           result = !regexec(&(expression->re), service->resource, 0, NULL, 0);
           break;
       case IPPFIND_OP_TXT_EXISTS :
-          result = cupsGetOption(expression->name, service->num_txt,
-                                service->txt) != NULL;
+          result = cupsGetOption(expression->name, service->num_txt, service->txt) != NULL;
           break;
       case IPPFIND_OP_TXT_REGEX :
-          val = cupsGetOption(expression->name, service->num_txt,
-                             service->txt);
+          val = cupsGetOption(expression->name, service->num_txt, service->txt);
          if (val)
            result = !regexec(&(expression->re), val, 0, NULL, 0);
          else
@@ -1871,75 +1293,67 @@ eval_expr(ippfind_srv_t  *service,      /* I - Service */
 }
 
 
-/*
- * 'exec_program()' - Execute a program for a service.
- */
+//
+// 'exec_program()' - Execute a program for a service.
+//
 
-static int                             /* O - 1 if program terminated
-                                              successfully, 0 otherwise. */
-exec_program(ippfind_srv_t *service,   /* I - Service */
-             int           num_args,   /* I - Number of command-line args */
-             char          **args)     /* I - Command-line arguments */
+static int                             // O - 1 if program terminated successfully, 0 otherwise
+exec_program(ippfind_srv_t *service,   // I - Service
+             size_t        num_args,   // I - Number of command-line args
+             char          **args)     // I - Command-line arguments
 {
-  char         **myargv,               /* Command-line arguments */
-               **myenvp,               /* Environment variables */
-               *ptr,                   /* Pointer into variable */
-               domain[1024],           /* IPPFIND_SERVICE_DOMAIN */
-               hostname[1024],         /* IPPFIND_SERVICE_HOSTNAME */
-               name[256],              /* IPPFIND_SERVICE_NAME */
-               port[32],               /* IPPFIND_SERVICE_PORT */
-               regtype[256],           /* IPPFIND_SERVICE_REGTYPE */
-               scheme[128],            /* IPPFIND_SERVICE_SCHEME */
-               uri[1024],              /* IPPFIND_SERVICE_URI */
-               txt[100][256];          /* IPPFIND_TXT_foo */
-  int          i,                      /* Looping var */
-               myenvc,                 /* Number of environment variables */
-               status;                 /* Exit status of program */
+  char         **myargv,               // Command-line arguments
+               **myenvp,               // Environment variables
+               *ptr,                   // Pointer into variable
+               domain[1024],           // IPPFIND_SERVICE_DOMAIN
+               hostname[1024],         // IPPFIND_SERVICE_HOSTNAME
+               name[256],              // IPPFIND_SERVICE_NAME
+               port[32],               // IPPFIND_SERVICE_PORT
+               regtype[256],           // IPPFIND_SERVICE_REGTYPE
+               scheme[128],            // IPPFIND_SERVICE_SCHEME
+               uri[1024],              // IPPFIND_SERVICE_URI
+               txt[100][256];          // IPPFIND_TXT_foo
+  size_t       i,                      // Looping var
+               myenvc;                 // Number of environment variables
+  int          status;                 // Exit status of program
 #ifndef _WIN32
-  char         program[1024];          /* Program to execute */
-  int          pid;                    /* Process ID */
-#endif /* !_WIN32 */
+  char         program[1024];          // Program to execute
+  int          pid;                    // Process ID
+#endif // !_WIN32
 
 
- /*
-  * Environment variables...
-  */
-
-  snprintf(domain, sizeof(domain), "IPPFIND_SERVICE_DOMAIN=%s",
-           service->domain);
-  snprintf(hostname, sizeof(hostname), "IPPFIND_SERVICE_HOSTNAME=%s",
-           service->host);
+  // Environment variables...
+  snprintf(domain, sizeof(domain), "IPPFIND_SERVICE_DOMAIN=%s", service->domain);
+  snprintf(hostname, sizeof(hostname), "IPPFIND_SERVICE_HOSTNAME=%s", service->host);
   snprintf(name, sizeof(name), "IPPFIND_SERVICE_NAME=%s", service->name);
   snprintf(port, sizeof(port), "IPPFIND_SERVICE_PORT=%d", service->port);
-  snprintf(regtype, sizeof(regtype), "IPPFIND_SERVICE_REGTYPE=%s",
-           service->regtype);
-  snprintf(scheme, sizeof(scheme), "IPPFIND_SERVICE_SCHEME=%s",
-           !strncmp(service->regtype, "_http._tcp", 10) ? "http" :
-               !strncmp(service->regtype, "_https._tcp", 11) ? "https" :
-               !strncmp(service->regtype, "_ipp._tcp", 9) ? "ipp" :
-               !strncmp(service->regtype, "_ipps._tcp", 10) ? "ipps" : "lpd");
+  snprintf(regtype, sizeof(regtype), "IPPFIND_SERVICE_REGTYPE=%s", service->regtype);
+  snprintf(scheme, sizeof(scheme), "IPPFIND_SERVICE_SCHEME=%s", !strncmp(service->regtype, "_http._tcp", 10) ? "http" : !strncmp(service->regtype, "_https._tcp", 11) ? "https" : !strncmp(service->regtype, "_ipp._tcp", 9) ? "ipp" : !strncmp(service->regtype, "_ipps._tcp", 10) ? "ipps" : "lpd");
   snprintf(uri, sizeof(uri), "IPPFIND_SERVICE_URI=%s", service->uri);
   for (i = 0; i < service->num_txt && i < 100; i ++)
   {
-    snprintf(txt[i], sizeof(txt[i]), "IPPFIND_TXT_%s=%s", service->txt[i].name,
-             service->txt[i].value);
+    snprintf(txt[i], sizeof(txt[i]), "IPPFIND_TXT_%s=%s", service->txt[i].name, service->txt[i].value);
     for (ptr = txt[i] + 12; *ptr && *ptr != '='; ptr ++)
       *ptr = (char)_cups_toupper(*ptr);
   }
 
   for (i = 0, myenvc = 7 + service->num_txt; environ[i]; i ++)
+  {
     if (strncmp(environ[i], "IPPFIND_", 8))
       myenvc ++;
+  }
 
-  if ((myenvp = calloc((size_t)(myenvc + 1), sizeof(char *))) == NULL)
+  if ((myenvp = calloc(sizeof(char *), (size_t)(myenvc + 1))) == NULL)
   {
     _cupsLangPuts(stderr, _("ippfind: Out of memory."));
     exit(IPPFIND_EXIT_MEMORY);
   }
 
   for (i = 0, myenvc = 0; environ[i]; i ++)
+  {
     if (strncmp(environ[i], "IPPFIND_", 8))
       myenvp[myenvc++] = environ[i];
+  }
 
   myenvp[myenvc++] = domain;
   myenvp[myenvc++] = hostname;
@@ -1952,11 +1366,8 @@ exec_program(ippfind_srv_t *service,     /* I - Service */
   for (i = 0; i < service->num_txt && i < 100; i ++)
     myenvp[myenvc++] = txt[i];
 
- /*
-  * Allocate and copy command-line arguments...
-  */
-
-  if ((myargv = calloc((size_t)(num_args + 1), sizeof(char *))) == NULL)
+  // Allocate and copy command-line arguments...
+  if ((myargv = calloc(sizeof(char *), (size_t)(num_args + 1))) == NULL)
   {
     _cupsLangPuts(stderr, _("ippfind: Out of memory."));
     exit(IPPFIND_EXIT_MEMORY);
@@ -1966,27 +1377,25 @@ exec_program(ippfind_srv_t *service,    /* I - Service */
   {
     if (strchr(args[i], '{'))
     {
-      char     temp[2048],             /* Temporary string */
-               *tptr,                  /* Pointer into temporary string */
-               keyword[256],           /* {keyword} */
-               *kptr;                  /* Pointer into keyword */
+      char     temp[2048],             // Temporary string
+               *tptr,                  // Pointer into temporary string
+               keyword[256],           // {keyword}
+               *kptr;                  // Pointer into keyword
 
       for (ptr = args[i], tptr = temp; *ptr; ptr ++)
       {
         if (*ptr == '{')
         {
-         /*
-          * Do a {var} substitution...
-          */
-
+          // Do a {var} substitution...
           for (kptr = keyword, ptr ++; *ptr && *ptr != '}'; ptr ++)
+          {
             if (kptr < (keyword + sizeof(keyword) - 1))
               *kptr++ = *ptr;
+          }
 
           if (*ptr != '}')
           {
-            _cupsLangPuts(stderr,
-                          _("ippfind: Missing close brace in substitution."));
+            _cupsLangPuts(stderr, _("ippfind: Missing close brace in substitution."));
             exit(IPPFIND_EXIT_SYNTAX);
           }
 
@@ -2027,13 +1436,20 @@ exec_program(ippfind_srv_t *service,    /* I - Service */
       }
 
       *tptr = '\0';
+#if _WIN32
+      myargv[i] = win32_escape_dup(temp);
+    }
+    else
+      myargv[i] = win32_escape_dup(args[i]);
+#else
       myargv[i] = strdup(temp);
     }
     else
       myargv[i] = strdup(args[i]);
+#endif // _WIN32
   }
 
-#ifdef _WIN32
+#if _WIN32
   if (getenv("IPPFIND_DEBUG"))
   {
     printf("\nProgram:\n    %s\n", args[0]);
@@ -2048,12 +1464,11 @@ exec_program(ippfind_srv_t *service,    /* I - Service */
   status = _spawnvpe(_P_WAIT, args[0], myargv, myenvp);
 
 #else
- /*
-  * Execute the program...
-  */
-
+  // Execute the program...
   if (strchr(args[0], '/') && !access(args[0], X_OK))
+  {
     cupsCopyString(program, args[0], sizeof(program));
+  }
   else if (!cupsFileFind(args[0], getenv("PATH"), 1, program, sizeof(program)))
   {
     _cupsLangPrintf(stderr, _("ippfind: Unable to execute \"%s\": %s"),
@@ -2074,10 +1489,7 @@ exec_program(ippfind_srv_t *service,     /* I - Service */
 
   if ((pid = fork()) == 0)
   {
-   /*
-    * Child comes here...
-    */
-
+    // Child comes here...
     execve(program, myargv, myenvp);
     exit(1);
   }
@@ -2089,29 +1501,20 @@ exec_program(ippfind_srv_t *service,    /* I - Service */
   }
   else
   {
-   /*
-    * Wait for it to complete...
-    */
-
+    // Wait for it to complete...
     while (wait(&status) != pid)
       ;
   }
-#endif /* _WIN32 */
-
- /*
-  * Free memory...
-  */
+#endif // _WIN32
 
+  // Free memory...
   for (i = 0; i < num_args; i ++)
     free(myargv[i]);
 
   free(myargv);
   free(myenvp);
 
- /*
-  * Return whether the program succeeded or crashed...
-  */
-
+  // Return whether the program succeeded or crashed...
   if (getenv("IPPFIND_DEBUG"))
   {
 #ifdef _WIN32
@@ -2121,109 +1524,105 @@ exec_program(ippfind_srv_t *service,  /* I - Service */
       printf("Exit Status: %d\n", WEXITSTATUS(status));
     else
       printf("Terminating Signal: %d\n", WTERMSIG(status));
-#endif /* _WIN32 */
+#endif // _WIN32
   }
 
   return (status == 0);
 }
 
 
-/*
- * 'get_service()' - Create or update a device.
- */
+//
+// 'get_service()' - Create or update a device.
+//
 
-static ippfind_srv_t *                 /* O - Service */
-get_service(cups_array_t *services,    /* I - Service array */
-           const char   *serviceName,  /* I - Name of service/device */
-           const char   *regtype,      /* I - Type of service */
-           const char   *replyDomain)  /* I - Service domain */
+static ippfind_srv_t *                 // O - Service
+get_service(ippfind_srvs_t *services,  // I - Service array
+           const char     *serviceName,// I - Name of service/device
+           const char     *regtype,    // I - Type of service
+           const char     *replyDomain)// I - Service domain
 {
-  ippfind_srv_t        key,                    /* Search key */
-               *service;               /* Service */
-  char         fullName[kDNSServiceMaxDomainName];
-                                       /* Full name for query */
+  size_t       i,                      // Looping var
+               count;                  // Number of services
+  ippfind_srv_t        key,                    // Search key
+               *service;               // Service
+  char         fullName[1024];         // Full name for query
 
 
- /*
-  * See if this is a new device...
-  */
-
+  // See if this is a new device...
   key.name    = (char *)serviceName;
   key.regtype = (char *)regtype;
 
-  for (service = cupsArrayFind(services, &key);
-       service;
-       service = cupsArrayNext(services))
-    if (_cups_strcasecmp(service->name, key.name))
-      break;
-    else if (!strcmp(service->regtype, key.regtype))
-      return (service);
+  cupsRWLockRead(&services->rwlock);
+  for (i = 0, count = cupsArrayGetCount(services->services); i < count; i ++)
+  {
+    service = (ippfind_srv_t *)cupsArrayGetElement(services->services, i);
 
- /*
-  * Yes, add the service...
-  */
+    if (!_cups_strcasecmp(service->name, key.name) && !strcmp(service->regtype, key.regtype))
+    {
+      cupsRWUnlock(&services->rwlock);
+      return (service);
+    }
+    else if (_cups_strcasecmp(service->name, key.name) > 0)
+    {
+      break;
+    }
+  }
+  cupsRWUnlock(&services->rwlock);
 
-  if ((service = calloc(1, sizeof(ippfind_srv_t))) == NULL)
+  // Yes, add the service...
+  if ((service = calloc(sizeof(ippfind_srv_t), 1)) == NULL)
     return (NULL);
 
   service->name     = strdup(serviceName);
   service->domain   = strdup(replyDomain);
   service->regtype  = strdup(regtype);
 
-  cupsArrayAdd(services, service);
-
- /*
-  * Set the "full name" of this service, which is used for queries and
-  * resolves...
-  */
-
-#ifdef HAVE_MDNSRESPONDER
-  DNSServiceConstructFullName(fullName, serviceName, regtype, replyDomain);
-#else /* HAVE_AVAHI */
-  avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName,
-                          regtype, replyDomain);
-#endif /* HAVE_MDNSRESPONDER */
+  cupsRWLockWrite(&services->rwlock);
+  cupsArrayAdd(services->services, service);
+  cupsRWUnlock(&services->rwlock);
 
+  // Set the "full name" of this service, which is used for queries and resolves...
+  cupsDNSSDAssembleFullName(fullName, sizeof(fullName), serviceName, regtype, replyDomain);
   service->fullName = strdup(fullName);
 
   return (service);
 }
 
 
-/*
- * 'get_time()' - Get the current time-of-day in seconds.
- */
+//
+// 'get_time()' - Get the current time-of-day in seconds.
+//
 
 static double
 get_time(void)
 {
 #ifdef _WIN32
-  struct _timeb curtime;               /* Current Windows time */
+  struct _timeb curtime;               // Current Windows time
 
   _ftime(&curtime);
 
   return (curtime.time + 0.001 * curtime.millitm);
 
 #else
-  struct timeval       curtime;        /* Current UNIX time */
+  struct timeval       curtime;        // Current UNIX time
 
   if (gettimeofday(&curtime, NULL))
     return (0.0);
   else
     return (curtime.tv_sec + 0.000001 * curtime.tv_usec);
-#endif /* _WIN32 */
+#endif // _WIN32
 }
 
 
-/*
- * 'list_service()' - List the contents of a service.
- */
+//
+// 'list_service()' - List the contents of a service.
+//
 
-static int                             /* O - 1 if successful, 0 otherwise */
-list_service(ippfind_srv_t *service)   /* I - Service */
+static int                             // O - 1 if successful, 0 otherwise
+list_service(ippfind_srv_t *service)   // I - Service
 {
-  http_addrlist_t      *addrlist;      /* Address(es) of service */
-  char                 port[10];       /* Port number of service */
+  http_addrlist_t      *addrlist;      // Address(es) of service
+  char                 port[10];       // Port number of service
 
 
   snprintf(port, sizeof(port), "%d", service->port);
@@ -2237,38 +1636,28 @@ list_service(ippfind_srv_t *service)    /* I - Service */
   if (!strncmp(service->regtype, "_ipp._tcp", 9) ||
       !strncmp(service->regtype, "_ipps._tcp", 10))
   {
-   /*
-    * IPP/IPPS printer
-    */
-
-    http_t             *http;          /* HTTP connection */
-    ipp_t              *request,       /* IPP request */
-                       *response;      /* IPP response */
-    ipp_attribute_t    *attr;          /* IPP attribute */
-    int                        i,              /* Looping var */
-                       count,          /* Number of values */
-                       version,        /* IPP version */
-                       paccepting;     /* printer-is-accepting-jobs value */
-    ipp_pstate_t       pstate;         /* printer-state value */
-    char               preasons[1024], /* Comma-delimited printer-state-reasons */
-                       *ptr,           /* Pointer into reasons */
-                       *end;           /* End of reasons buffer */
-    static const char * const rattrs[] =/* Requested attributes */
+    // IPP/IPPS printer
+    http_t             *http;          // HTTP connection
+    ipp_t              *request,       // IPP request
+                       *response;      // IPP response
+    ipp_attribute_t    *attr;          // IPP attribute
+    size_t             i,              // Looping var
+                       count;          // Number of values
+    int                        version;        // IPP version
+    bool               paccepting;     // printer-is-accepting-jobs value
+    ipp_pstate_t       pstate;         // printer-state value
+    char               preasons[1024], // Comma-delimited printer-state-reasons
+                       *ptr,           // Pointer into reasons
+                       *end;           // End of reasons buffer
+    static const char * const rattrs[] =// Requested attributes
     {
       "printer-is-accepting-jobs",
       "printer-state",
       "printer-state-reasons"
     };
 
-   /*
-    * Connect to the printer...
-    */
-
-    http = httpConnect2(service->host, service->port, addrlist, address_family,
-                       !strncmp(service->regtype, "_ipps._tcp", 10) ?
-                           HTTP_ENCRYPTION_ALWAYS :
-                           HTTP_ENCRYPTION_IF_REQUESTED,
-                       1, 30000, NULL);
+    // Connect to the printer...
+    http = httpConnect2(service->host, service->port, addrlist, address_family, !strncmp(service->regtype, "_ipps._tcp", 10) ? HTTP_ENCRYPTION_ALWAYS : HTTP_ENCRYPTION_IF_REQUESTED, 1, 30000, NULL);
 
     httpAddrFreeList(addrlist);
 
@@ -2278,10 +1667,7 @@ list_service(ippfind_srv_t *service)     /* I - Service */
       return (0);
     }
 
-   /*
-    * Get the current printer state...
-    */
-
+    // Get the current printer state...
     response = NULL;
     version  = ipp_version;
 
@@ -2289,13 +1675,9 @@ list_service(ippfind_srv_t *service)     /* I - Service */
     {
       request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
       ippSetVersion(request, version / 10, version % 10);
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
-                   service->uri);
-      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
-                   "requesting-user-name", NULL, cupsGetUser());
-      ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
-                    "requested-attributes",
-                    (int)(sizeof(rattrs) / sizeof(rattrs[0])), NULL, rattrs);
+      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, service->uri);
+      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsGetUser());
+      ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(rattrs) / sizeof(rattrs[0]), NULL, rattrs);
 
       response = cupsDoRequest(http, request, service->resource);
 
@@ -2304,70 +1686,51 @@ list_service(ippfind_srv_t *service)    /* I - Service */
     }
     while (cupsGetError() > IPP_STATUS_OK_EVENTS_COMPLETE && version > 11);
 
-   /*
-    * Show results...
-    */
-
+    // Show results...
     if (cupsGetError() > IPP_STATUS_OK_EVENTS_COMPLETE)
     {
       _cupsLangPrintf(stdout, "%s: unavailable", service->uri);
       return (0);
     }
 
-    if ((attr = ippFindAttribute(response, "printer-state",
-                                 IPP_TAG_ENUM)) != NULL)
+    if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL)
       pstate = (ipp_pstate_t)ippGetInteger(attr, 0);
     else
       pstate = IPP_PSTATE_STOPPED;
 
-    if ((attr = ippFindAttribute(response, "printer-is-accepting-jobs",
-                                 IPP_TAG_BOOLEAN)) != NULL)
+    if ((attr = ippFindAttribute(response, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN)) != NULL)
       paccepting = ippGetBoolean(attr, 0);
     else
       paccepting = 0;
 
-    if ((attr = ippFindAttribute(response, "printer-state-reasons",
-                                 IPP_TAG_KEYWORD)) != NULL)
+    if ((attr = ippFindAttribute(response, "printer-state-reasons", IPP_TAG_KEYWORD)) != NULL)
     {
       cupsCopyString(preasons, ippGetString(attr, 0, NULL), sizeof(preasons));
 
-      for (i = 1, count = ippGetCount(attr), ptr = preasons + strlen(preasons),
-               end = preasons + sizeof(preasons) - 1;
-           i < count && ptr < end;
-           i ++, ptr += strlen(ptr))
+      for (i = 1, count = ippGetCount(attr), ptr = preasons + strlen(preasons), end = preasons + sizeof(preasons) - 1; i < count && ptr < end; i ++, ptr += strlen(ptr))
       {
         *ptr++ = ',';
         cupsCopyString(ptr, ippGetString(attr, i, NULL), (size_t)(end - ptr + 1));
       }
     }
     else
+    {
       cupsCopyString(preasons, "none", sizeof(preasons));
+    }
 
     ippDelete(response);
     httpClose(http);
 
     _cupsLangPrintf(stdout, "%s %s %s %s", service->uri, ippEnumString("printer-state", (int)pstate), paccepting ? "accepting-jobs" : "not-accepting-jobs", preasons);
   }
-  else if (!strncmp(service->regtype, "_http._tcp", 10) ||
-           !strncmp(service->regtype, "_https._tcp", 11))
+  else if (!strncmp(service->regtype, "_http._tcp", 10) || !strncmp(service->regtype, "_https._tcp", 11))
   {
-   /*
-    * HTTP/HTTPS web page
-    */
+    // HTTP/HTTPS web page
+    http_t             *http;          // HTTP connection
+    http_status_t      status;         // HEAD status
 
-    http_t             *http;          /* HTTP connection */
-    http_status_t      status;         /* HEAD status */
-
-
-   /*
-    * Connect to the web server...
-    */
-
-    http = httpConnect2(service->host, service->port, addrlist, address_family,
-                       !strncmp(service->regtype, "_ipps._tcp", 10) ?
-                           HTTP_ENCRYPTION_ALWAYS :
-                           HTTP_ENCRYPTION_IF_REQUESTED,
-                       1, 30000, NULL);
+    // Connect to the web server...
+    http = httpConnect2(service->host, service->port, addrlist, address_family, !strncmp(service->regtype, "_ipps._tcp", 10) ? HTTP_ENCRYPTION_ALWAYS : HTTP_ENCRYPTION_IF_REQUESTED, 1, 30000, NULL);
 
     httpAddrFreeList(addrlist);
 
@@ -2402,12 +1765,8 @@ list_service(ippfind_srv_t *service)     /* I - Service */
   }
   else if (!strncmp(service->regtype, "_printer._tcp", 13))
   {
-   /*
-    * LPD printer
-    */
-
-    int        sock;                           /* Socket */
-
+    // LPD printer
+    int        sock;                           // Socket
 
     if (!httpAddrConnect2(addrlist, &sock, 30000, NULL))
     {
@@ -2432,35 +1791,34 @@ list_service(ippfind_srv_t *service)    /* I - Service */
 }
 
 
-/*
- * 'new_expr()' - Create a new expression.
- */
+//
+// 'new_expr()' - Create a new expression.
+//
 
-static ippfind_expr_t *                        /* O - New expression */
-new_expr(ippfind_op_t op,              /* I - Operation */
-         int          invert,          /* I - Invert result? */
-         const char   *value,          /* I - TXT key or port range */
-        const char   *regex,           /* I - Regular expression */
-        char         **args)           /* I - Pointer to argument strings */
+static ippfind_expr_t *                        // O - New expression
+new_expr(ippfind_op_t op,              // I - Operation
+         bool         invert,          // I - Invert result?
+         const char   *value,          // I - TXT key or port range
+        const char   *regex,           // I - Regular expression
+        char         **args)           // I - Pointer to argument strings
 {
-  ippfind_expr_t       *temp;          /* New expression */
+  ippfind_expr_t       *temp;          // New expression
 
 
   if ((temp = calloc(1, sizeof(ippfind_expr_t))) == NULL)
     return (NULL);
 
-  temp->op = op;
+  temp->op     = op;
   temp->invert = invert;
 
   if (op == IPPFIND_OP_TXT_EXISTS || op == IPPFIND_OP_TXT_REGEX || op == IPPFIND_OP_NAME_LITERAL)
+  {
     temp->name = (char *)value;
+  }
   else if (op == IPPFIND_OP_PORT_RANGE)
   {
-   /*
-    * Pull port number range of the form "number", "-number" (0-number),
-    * "number-" (number-65535), and "number-number".
-    */
-
+    // Pull port number range of the form "number", "-number" (0-number),
+    // "number-" (number-65535), and "number-number".
     if (*value == '-')
     {
       temp->range[1] = atoi(value + 1);
@@ -2482,28 +1840,31 @@ new_expr(ippfind_op_t op,               /* I - Operation */
 
     if (err)
     {
-      char     message[256];           /* Error message */
+      char     message[256];           // Error message
 
       regerror(err, &(temp->re), message, sizeof(message));
-      _cupsLangPrintf(stderr, _("ippfind: Bad regular expression: %s"),
-                      message);
+      _cupsLangPrintf(stderr, _("ippfind: Bad regular expression: %s"), message);
       exit(IPPFIND_EXIT_SYNTAX);
     }
   }
 
   if (args)
   {
-    int        num_args;                       /* Number of arguments */
+    size_t     num_args;               // Number of arguments
 
     for (num_args = 1; args[num_args]; num_args ++)
+    {
       if (!strcmp(args[num_args], ";"))
         break;
+    }
 
     temp->num_args = num_args;
-    temp->args     = malloc((size_t)num_args * sizeof(char *));
-    if (temp->args == NULL)
+    if ((temp->args = malloc(num_args * sizeof(char *))) == NULL)
+    {
+      regfree(&temp->re);
+      free(temp);
       return (NULL);
-
+    }
     memcpy(temp->args, args, (size_t)num_args * sizeof(char *));
   }
 
@@ -2511,157 +1872,43 @@ new_expr(ippfind_op_t op,              /* I - Operation */
 }
 
 
-#ifdef HAVE_AVAHI
-/*
- * 'poll_callback()' - Wait for input on the specified file descriptors.
- *
- * Note: This function is needed because avahi_simple_poll_iterate is broken
- *       and always uses a timeout of 0 (!) milliseconds.
- *       (Avahi Ticket #364)
- */
-
-static int                             /* O - Number of file descriptors matching */
-poll_callback(
-    struct pollfd *pollfds,            /* I - File descriptors */
-    unsigned int  num_pollfds,         /* I - Number of file descriptors */
-    int           timeout,             /* I - Timeout in milliseconds (unused) */
-    void          *context)            /* I - User data (unused) */
-{
-  int  val;                            /* Return value */
-
-
-  (void)timeout;
-  (void)context;
-
-  val = poll(pollfds, num_pollfds, 500);
-
-  if (val > 0)
-    avahi_got_data = 1;
-
-  return (val);
-}
-#endif /* HAVE_AVAHI */
-
-
-/*
- * 'resolve_callback()' - Process resolve data.
- */
+//
+// 'resolve_callback()' - Process resolve data.
+//
 
-#ifdef HAVE_MDNSRESPONDER
-static void DNSSD_API
+static void
 resolve_callback(
-    DNSServiceRef       sdRef,         /* I - Service reference */
-    DNSServiceFlags     flags,         /* I - Data flags */
-    uint32_t            interfaceIndex,        /* I - Interface */
-    DNSServiceErrorType errorCode,     /* I - Error, if any */
-    const char          *fullName,     /* I - Full service name */
-    const char          *hostTarget,   /* I - Hostname */
-    uint16_t            port,          /* I - Port number (network byte order) */
-    uint16_t            txtLen,                /* I - Length of TXT record data */
-    const unsigned char *txtRecord,    /* I - TXT record data */
-    void                *context)      /* I - Service */
+    cups_dnssd_resolve_t *resolve,     // I - Resolver
+    void                 *context,     // I - Service
+    cups_dnssd_flags_t   flags,                // I - Flags
+    uint32_t             if_index,     // I - Interface index
+    const char           *fullName,    // I - Full service name
+    const char           *hostTarget,  // I - Hostname
+    uint16_t             port,         // I - Port number
+    size_t               num_txt,      // I - Number of TXT key/value pairs
+    cups_option_t        *txt)         // I - TXT key/value pairs
 {
-  char                 key[256],       /* TXT key value */
-                       *value;         /* Value from TXT record */
-  const unsigned char  *txtEnd;        /* End of TXT record */
-  uint8_t              valueLen;       /* Length of value */
   ippfind_srv_t                *service = (ippfind_srv_t *)context;
-                                       /* Service */
+                                       // Service
+  size_t               i;              // Looping var
+  char                 *value;         // Pointer into value
 
 
- /*
-  * Only process "add" data...
-  */
+  if (getenv("IPPFIND_DEBUG"))
+    fprintf(stderr, "R flags=0x%04X, if_index=%u, fullName=\"%s\", hostTarget=\"%s\", port=%u, num_txt=%u, txt=%p\n", flags, if_index, fullName, hostTarget, port, (unsigned)num_txt, txt);
 
-  (void)sdRef;
-  (void)flags;
-  (void)interfaceIndex;
+  (void)resolve;
+  (void)if_index;
   (void)fullName;
 
-   if (errorCode != kDNSServiceErr_NoError)
+  // Only process "add" data...
+  if (flags & CUPS_DNSSD_FLAGS_ERROR)
   {
-    _cupsLangPrintf(stderr, _("ippfind: Unable to browse or resolve: %s"),
-                   dnssd_error_string(errorCode));
     bonjour_error = 1;
     return;
   }
 
-  service->is_resolved = 1;
-  service->host        = strdup(hostTarget);
-  service->port        = ntohs(port);
-
-  value = service->host + strlen(service->host) - 1;
-  if (value >= service->host && *value == '.')
-    *value = '\0';
-
- /*
-  * Loop through the TXT key/value pairs and add them to an array...
-  */
-
-  for (txtEnd = txtRecord + txtLen; txtRecord < txtEnd; txtRecord += valueLen)
-  {
-   /*
-    * Ignore bogus strings...
-    */
-
-    valueLen = *txtRecord++;
-
-    memcpy(key, txtRecord, valueLen);
-    key[valueLen] = '\0';
-
-    if ((value = strchr(key, '=')) == NULL)
-      continue;
-
-    *value++ = '\0';
-
-   /*
-    * Add to array of TXT values...
-    */
-
-    service->num_txt = cupsAddOption(key, value, service->num_txt,
-                                     &(service->txt));
-  }
-
-  set_service_uri(service);
-}
-
-
-#elif defined(HAVE_AVAHI)
-static void
-resolve_callback(
-    AvahiServiceResolver   *resolver,  /* I - Resolver */
-    AvahiIfIndex           interface,  /* I - Interface */
-    AvahiProtocol          protocol,   /* I - Address protocol */
-    AvahiResolverEvent     event,      /* I - Event */
-    const char             *serviceName,/* I - Service name */
-    const char             *regtype,   /* I - Registration type */
-    const char             *replyDomain,/* I - Domain name */
-    const char             *hostTarget,        /* I - FQDN */
-    const AvahiAddress     *address,   /* I - Address */
-    uint16_t               port,       /* I - Port number */
-    AvahiStringList        *txt,       /* I - TXT records */
-    AvahiLookupResultFlags flags,      /* I - Lookup flags */
-    void                   *context)   /* I - Service */
-{
-  char         key[256],               /* TXT key */
-               *value;                 /* TXT value */
-  ippfind_srv_t        *service = (ippfind_srv_t *)context;
-                                       /* Service */
-  AvahiStringList *current;            /* Current TXT key/value pair */
-
-
-  (void)address;
-
-  if (event != AVAHI_RESOLVER_FOUND)
-  {
-    bonjour_error = 1;
-
-    avahi_service_resolver_free(resolver);
-    avahi_simple_poll_quit(avahi_poll);
-    return;
-  }
-
-  service->is_resolved = 1;
+  service->is_resolved = true;
   service->host        = strdup(hostTarget);
   service->port        = port;
 
@@ -2669,50 +1916,24 @@ resolve_callback(
   if (value >= service->host && *value == '.')
     *value = '\0';
 
- /*
-  * Loop through the TXT key/value pairs and add them to an array...
-  */
-
-  for (current = txt; current; current = current->next)
-  {
-   /*
-    * Ignore bogus strings...
-    */
-
-    if (current->size > (sizeof(key) - 1))
-      continue;
-
-    memcpy(key, current->text, current->size);
-    key[current->size] = '\0';
-
-    if ((value = strchr(key, '=')) == NULL)
-      continue;
-
-    *value++ = '\0';
-
-   /*
-    * Add to array of TXT values...
-    */
-
-    service->num_txt = cupsAddOption(key, value, service->num_txt,
-                                     &(service->txt));
-  }
+  // Loop through the TXT key/value pairs and add them to an array...
+  for (i = 0; i < num_txt; i ++)
+    service->num_txt = cupsAddOption(txt[i].name, txt[i].value, service->num_txt, &service->txt);
 
   set_service_uri(service);
 }
-#endif /* HAVE_MDNSRESPONDER */
 
 
-/*
- * 'set_service_uri()' - Set the URI of the service.
- */
+//
+// 'set_service_uri()' - Set the URI of the service.
+//
 
 static void
-set_service_uri(ippfind_srv_t *service)        /* I - Service */
+set_service_uri(ippfind_srv_t *service)        // I - Service
 {
-  char         uri[1024];              /* URI */
-  const char   *path,                  /* Resource path */
-               *scheme;                /* URI scheme */
+  char         uri[1024];              // URI
+  const char   *path,                  // Resource path
+               *scheme;                // URI scheme
 
 
   if (!strncmp(service->regtype, "_http.", 6))
@@ -2756,15 +1977,14 @@ set_service_uri(ippfind_srv_t *service) /* I - Service */
     service->resource = strdup(uri);
   }
 
-  httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), scheme, NULL,
-                 service->host, service->port, service->resource);
+  httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri), scheme, NULL, service->host, service->port, service->resource);
   service->uri = strdup(uri);
 }
 
 
-/*
- * 'show_usage()' - Show program usage.
- */
+//
+// 'show_usage()' - Show program usage.
+//
 
 static void
 show_usage(void)
@@ -2849,9 +2069,9 @@ show_usage(void)
 }
 
 
-/*
- * 'show_version()' - Show program version.
- */
+//
+// 'show_version()' - Show program version.
+//
 
 static void
 show_version(void)
@@ -2860,3 +2080,96 @@ show_version(void)
 
   exit(IPPFIND_EXIT_TRUE);
 }
+
+
+//
+// 'win32_escape_dup()' - Escape and duplicate a string.
+//
+// This function puts the string in double quotes, escaping characters in the
+// string as needed using Windows' insane command-line argument parsing rules.
+//
+
+#if _WIN32
+static char *                          // O - Duplicated string
+win32_escape_dup(const char *s)                // I - Original string
+{
+  char         *d,                     // Output string
+               *dptr;                  // Pointer into output string
+  size_t       dlen;                   // Length of output string
+  const char   *sptr;                  // Pointer into original string
+
+
+  // Figure out the length of the escaped string...
+  for (dlen = 2, sptr = s; *sptr; sptr ++)
+  {
+    if (*sptr == '\\')
+    {
+      if (sptr[1] == '\"' || sptr[1] == '\\')
+      {
+        // \" and \\ need to be converted to \\\" or \\\\...
+        dlen += 4;
+        sptr ++;
+      }
+      else
+      {
+        // A lone \ can stand on its own...
+        dlen ++;
+      }
+    }
+    else if (*sptr == '\"')
+    {
+      // Need to replace " with ""...
+      dlen += 2;
+    }
+    else
+    {
+      // Not a special character so it is fine on its own...
+      dlen ++;
+    }
+  }
+
+  // Allocate memory (plus nul)...
+  if ((d = calloc(1, dlen + 1)) == NULL)
+    return (NULL);
+
+  // Copy and escape...
+  *d = '\"';
+  for (dptr = d + 1, sptr = s; *sptr; sptr ++)
+  {
+    if (*sptr == '\\')
+    {
+      if (sptr[1] == '\"' || sptr[1] == '\\')
+      {
+        // \" and \\ need to be converted to \\\" or \\\\...
+        sptr ++;
+
+        *dptr++ = '\\';
+        *dptr++ = '\\';
+        *dptr++ = '\\';
+        *dptr++ = *sptr;
+      }
+      else
+      {
+        // A lone \ can stand on its own...
+        *dptr++ = '\\';
+      }
+    }
+    else if (*sptr == '\"')
+    {
+      // Need to replace " with ""...
+      *dptr++ = '\"';
+      *dptr++ = '\"';
+    }
+    else
+    {
+      // Not a special character so it is fine on its own...
+      *dptr++ = *sptr;
+    }
+  }
+
+  *dptr++ = '\"';
+  *dptr   = '\0';
+
+  return (d);
+}
+#endif // _WIN32
index f8af47aff9ddee81a3cf7baa37ace886fd6fc9d0..805247aa4d175ff65a164a57070fb3eaab1bf66b 100644 (file)
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\cups\adminutil.h" />
-    <ClInclude Include="..\cups\array-private.h" />
     <ClInclude Include="..\cups\array.h" />
     <ClInclude Include="..\cups\cups-private.h" />
     <ClInclude Include="..\cups\cups.h" />
index 62796bfea7f2c50dc81b4e539ca0c225a9a7afaa..f2c07a9f66234716d0b6f6648cd4de70121a9de0 100644 (file)
     <ClInclude Include="..\cups\raster-private.h">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\cups\array-private.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\cups\versioning.h">
       <Filter>Header Files</Filter>
     </ClInclude>