]> git.netwichtig.de Git - user/henk/code/exim.git/blobdiff - src/src/lookups/nisplus.c
Hints DB interface: convert from macros to inlinable functions.
[user/henk/code/exim.git] / src / src / lookups / nisplus.c
index 0dff480f599aad6ac491a560c78144d7c59f9588..0892fc4c3dcca017c43a186d40971686ce71cbc1 100644 (file)
@@ -3,6 +3,7 @@
 *************************************************/
 
 /* Copyright (c) University of Cambridge 1995 - 2018 */
+/* Copyright (c) The Exim Maintainers 2020 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 #include "../exim.h"
@@ -225,25 +226,24 @@ characters. No options are recognized.
 Arguments:
   s          the string to be quoted
   opt        additional option text or NULL if none
+  idx       lookup type index
 
 Returns:     the processed string or NULL for a bad option
 */
 
 static uschar *
-nisplus_quote(uschar *s, uschar *opt)
+nisplus_quote(uschar * s, uschar * opt, unsigned idx)
 {
 int count = 0;
-uschar *quoted;
-uschar *t = s;
+uschar * quoted, * t = s;
 
-if (opt != NULL) return NULL;    /* No options recognized */
+if (opt) return NULL;    /* No options recognized */
 
-while (*t != 0) if (*t++ == '\"') count++;
-if (count == 0) return s;
+while (*t) if (*t++ == '\"') count++;
 
-t = quoted = store_get(Ustrlen(s) + count + 1, is_tainted(s));
+t = quoted = store_get_quoted(Ustrlen(s) + count + 1, s, idx);
 
-while (*s != 0)
+while (*s)
   {
   *t++ = *s;
   if (*s++ == '\"') *t++ = '\"';
@@ -262,12 +262,13 @@ return quoted;
 
 #include "../version.h"
 
-void
-nisplus_version_report(FILE *f)
+gstring *
+nisplus_version_report(gstring * g)
 {
 #ifdef DYNLOOKUP
-fprintf(f, "Library version: NIS+: Exim version %s\n", EXIM_VERSION_STR);
+g = string_fmt_append(g, "Library version: NIS+: Exim version %s\n", EXIM_VERSION_STR);
 #endif
+return g;
 }