[Exim] [patch] A few minor fixes/improvements.

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Alexander V Alekseev
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: [Exim] [patch] A few minor fixes/improvements.
        Hello!

    Writing my own lookup type I found out several
features, which don't help developing. So, I made a few
small patches:


1. It's impossible to have '}' symbols in lookup keys.
But, sometimes it's quite usefull. Please, consider a patch:
###########################################################
diff -ruN exim-4.10-orig/src/expand.c exim-4.10-fixed/src/expand.c
--- exim-4.10-orig/src/expand.c Mon Jul 22 12:59:48 2002
+++ exim-4.10-fixed/src/expand.c        Thu Oct 17 23:35:40 2002
@@ -1693,6 +1693,7 @@
 {
 int ptr = 0;
 int size = 0;
+int block_level = 0; /* Level of {} blocks */
 uschar *yield = NULL;
 uschar *s = string;
 uschar *save_expand_nstring[EXPAND_MAXN+1];
@@ -1741,7 +1742,11 @@
   /* Anything other than $ is just copied verbatim, unless we are
   looking for a terminating } character. */


-  if (ket_ends && *s == '}') break;
+  if ( *s == '{' ) block_level++;
+  else if (*s == '}'){
+         block_level --;
+         if (ket_ends && block_level < 0) break;
+  }


   if (*s != '$')
     {
###########################################################


2. Most people use GNU C. It has several quite usefull
features for developer. For example, can test printf format
strings:
###########################################################
diff -ruN exim-4.10-orig/src/functions.h exim-4.10-fixed/src/functions.h
--- exim-4.10-orig/src/functions.h      Mon Jul 22 12:59:48 2002
+++ exim-4.10-fixed/src/functions.h     Thu Oct 17 23:35:40 2002
@@ -52,7 +52,11 @@
                  int *, uschar *, BOOL);


 extern void    daemon_go(void);
-extern void    debug_printf(char *, ...);
+extern void    debug_printf(char *, ...)
+#ifdef __GNUC__
+        __attribute__ ((format(printf,1,2)))
+#endif
+       ;
 extern void    debug_print_argv(uschar **);
 extern void    debug_print_ids(uschar *);
 extern void    debug_print_string(uschar *);
###########################################################


    I hope, those patches will be usefull. At least,
I really need the first one for my shared cashe lookup type.


    BTW, what is the recommended process, of submitting
big patches?  I suppose, posting 3000+ lines is not good.


        Bye. Alex.