svn commit: samba r24701 - in branches: SAMBA_3_2/source SAMBA_3_2/source/web SAMBA_3_2_0/source SAMBA_3_2_0/source/web

vlendec at samba.org vlendec at samba.org
Mon Aug 27 11:41:09 GMT 2007


Author: vlendec
Date: 2007-08-27 11:41:05 +0000 (Mon, 27 Aug 2007)
New Revision: 24701

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24701

Log:
Fix the swat build

Swat has not been built by default for a while, so I did not notice that
the _ macro is actually used. Re-add the lang_msg_rotate function, this
time only to swat so that this is the only binary that has to take the
16k penalty.

Modified:
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/web/statuspage.c
   branches/SAMBA_3_2/source/web/swat.c
   branches/SAMBA_3_2_0/source/configure.in
   branches/SAMBA_3_2_0/source/web/statuspage.c
   branches/SAMBA_3_2_0/source/web/swat.c


Changeset:
Modified: branches/SAMBA_3_2/source/configure.in
===================================================================
--- branches/SAMBA_3_2/source/configure.in	2007-08-27 11:17:48 UTC (rev 24700)
+++ branches/SAMBA_3_2/source/configure.in	2007-08-27 11:41:05 UTC (rev 24701)
@@ -354,21 +354,23 @@
 
 m4_include(lib/socket_wrapper/config.m4)
 
+SWAT_SBIN_TARGETS='bin/swat$(EXEEXT)'
+SWAT_INSTALL_TARGETS=installswat
 
 AC_ARG_ENABLE(swat,
 [  --enable-swat           Build the SWAT tool (default=yes)],
 [
     case "$enable_swat" in
-	no) ;;
-	*)
-	    SWAT_SBIN_TARGETS='bin/swat$(EXEEXT)'
-	    SWAT_INSTALL_TARGETS=installswat
+	no)
+	    SWAT_SBIN_TARGETS=''
+	    SWAT_INSTALL_TARGETS=''
 	    ;;
     esac
-    AC_SUBST(SWAT_SBIN_TARGETS)
-    AC_SUBST(SWAT_INSTALL_TARGETS)
 ])
 
+AC_SUBST(SWAT_SBIN_TARGETS)
+AC_SUBST(SWAT_INSTALL_TARGETS)
+
 #################################################
 # set prefix for 'make test'
 selftest_prefix="./"

Modified: branches/SAMBA_3_2/source/web/statuspage.c
===================================================================
--- branches/SAMBA_3_2/source/web/statuspage.c	2007-08-27 11:17:48 UTC (rev 24700)
+++ branches/SAMBA_3_2/source/web/statuspage.c	2007-08-27 11:41:05 UTC (rev 24701)
@@ -20,6 +20,8 @@
 #include "includes.h"
 #include "web/swat_proto.h"
 
+#define _(x) lang_msg_rotate(x)
+
 #define PIDMAP		struct PidMap
 
 /* how long to wait for start/stops to take effect */

Modified: branches/SAMBA_3_2/source/web/swat.c
===================================================================
--- branches/SAMBA_3_2/source/web/swat.c	2007-08-27 11:17:48 UTC (rev 24700)
+++ branches/SAMBA_3_2/source/web/swat.c	2007-08-27 11:41:05 UTC (rev 24701)
@@ -51,6 +51,7 @@
 #define ENABLE_USER_FLAG "enable_user_flag"
 #define RHOST "remote_host"
 
+#define _(x) lang_msg_rotate(x)
 
 /****************************************************************************
 ****************************************************************************/
@@ -1328,7 +1329,31 @@
 	printf("</FORM>\n");
 }
 
+/*
+  when the _() translation macro is used there is no obvious place to free
+  the resulting string and there is no easy way to give a static pointer.
+  All we can do is rotate between some static buffers and hope a single d_printf()
+  doesn't have more calls to _() than the number of buffers
+*/
 
+const char *lang_msg_rotate(const char *msgid)
+{
+#define NUM_LANG_BUFS 16
+	char *msgstr;
+	static pstring bufs[NUM_LANG_BUFS];
+	static int next;
+
+	msgstr = (char *)lang_msg(msgid);
+	if (!msgstr) return msgid;
+
+	pstrcpy(bufs[next], msgstr);
+	msgstr = bufs[next];
+
+	next = (next+1) % NUM_LANG_BUFS;
+
+	return msgstr;
+}
+
 /**
  * main function for SWAT.
  **/

Modified: branches/SAMBA_3_2_0/source/configure.in
===================================================================
--- branches/SAMBA_3_2_0/source/configure.in	2007-08-27 11:17:48 UTC (rev 24700)
+++ branches/SAMBA_3_2_0/source/configure.in	2007-08-27 11:41:05 UTC (rev 24701)
@@ -353,21 +353,23 @@
 
 m4_include(lib/socket_wrapper/config.m4)
 
+SWAT_SBIN_TARGETS='bin/swat$(EXEEXT)'
+SWAT_INSTALL_TARGETS=installswat
 
 AC_ARG_ENABLE(swat,
 [  --enable-swat           Build the SWAT tool (default=yes)],
 [
     case "$enable_swat" in
-	no) ;;
-	*)
-	    SWAT_SBIN_TARGETS='bin/swat$(EXEEXT)'
-	    SWAT_INSTALL_TARGETS=installswat
+	no)
+	    SWAT_SBIN_TARGETS=''
+	    SWAT_INSTALL_TARGETS=''
 	    ;;
     esac
-    AC_SUBST(SWAT_SBIN_TARGETS)
-    AC_SUBST(SWAT_INSTALL_TARGETS)
 ])
 
+AC_SUBST(SWAT_SBIN_TARGETS)
+AC_SUBST(SWAT_INSTALL_TARGETS)
+
 #################################################
 # set prefix for 'make test'
 selftest_prefix="./"

Modified: branches/SAMBA_3_2_0/source/web/statuspage.c
===================================================================
--- branches/SAMBA_3_2_0/source/web/statuspage.c	2007-08-27 11:17:48 UTC (rev 24700)
+++ branches/SAMBA_3_2_0/source/web/statuspage.c	2007-08-27 11:41:05 UTC (rev 24701)
@@ -20,6 +20,8 @@
 #include "includes.h"
 #include "web/swat_proto.h"
 
+#define _(x) lang_msg_rotate(x)
+
 #define PIDMAP		struct PidMap
 
 /* how long to wait for start/stops to take effect */

Modified: branches/SAMBA_3_2_0/source/web/swat.c
===================================================================
--- branches/SAMBA_3_2_0/source/web/swat.c	2007-08-27 11:17:48 UTC (rev 24700)
+++ branches/SAMBA_3_2_0/source/web/swat.c	2007-08-27 11:41:05 UTC (rev 24701)
@@ -51,6 +51,7 @@
 #define ENABLE_USER_FLAG "enable_user_flag"
 #define RHOST "remote_host"
 
+#define _(x) lang_msg_rotate(x)
 
 /****************************************************************************
 ****************************************************************************/
@@ -1328,7 +1329,31 @@
 	printf("</FORM>\n");
 }
 
+/*
+  when the _() translation macro is used there is no obvious place to free
+  the resulting string and there is no easy way to give a static pointer.
+  All we can do is rotate between some static buffers and hope a single d_printf()
+  doesn't have more calls to _() than the number of buffers
+*/
 
+const char *lang_msg_rotate(const char *msgid)
+{
+#define NUM_LANG_BUFS 16
+	char *msgstr;
+	static pstring bufs[NUM_LANG_BUFS];
+	static int next;
+
+	msgstr = (char *)lang_msg(msgid);
+	if (!msgstr) return msgid;
+
+	pstrcpy(bufs[next], msgstr);
+	msgstr = bufs[next];
+
+	next = (next+1) % NUM_LANG_BUFS;
+
+	return msgstr;
+}
+
 /**
  * main function for SWAT.
  **/



More information about the samba-cvs mailing list