summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-05-08 08:27:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:44 -0500
commit721270ebad0a80fd3a608c4a6bd8c4218c6b774a (patch)
tree8cd055c4d83c23b9cb27fc0499b5114e171dfdf6
parent2a8925ad2509e1e777e4eb3e7712a5cf68847ab5 (diff)
downloadsamba-721270ebad0a80fd3a608c4a6bd8c4218c6b774a.tar.gz
samba-721270ebad0a80fd3a608c4a6bd8c4218c6b774a.tar.bz2
samba-721270ebad0a80fd3a608c4a6bd8c4218c6b774a.zip
r15510: As discussed on samba-technical, move the VERSION system back to a
#define based system only. This avoids allocation in the fault code. Andrew Bartlett (This used to be commit 31c97b4e67ba6a188d0ed4844ca4f2f86f29514f)
-rw-r--r--source4/VERSION18
-rw-r--r--source4/lib/version.c37
-rwxr-xr-xsource4/script/mkversion.sh30
3 files changed, 15 insertions, 70 deletions
diff --git a/source4/VERSION b/source4/VERSION
index 75b1abbd20..79169839c0 100644
--- a/source4/VERSION
+++ b/source4/VERSION
@@ -74,7 +74,7 @@ SAMBA_VERSION_RC_RELEASE=
# in the development BRANCH, and set to 'no' only in #
# the SAMBA_X_X_RELEASE BRANCH #
# #
-# <MAJOR>.<MINOR>.<RELEASE>[...]cvs #
+# <MAJOR>.<MINOR>.<RELEASE>[...]-SVN-build-xxx #
# #
# e.g. SAMBA_VERSION_IS_SVN_SNAPSHOT=yes #
# -> "3.0.0-SVN-build-199" #
@@ -84,7 +84,7 @@ SAMBA_VERSION_IS_SVN_SNAPSHOT=yes
########################################################
# This is for specifying a release nickname #
# #
-# e.g. SAMBA_VERSION_RELEASE_NICKNAME="Nicky Nickname" #
+# e.g. SAMBA_VERSION_RELEASE_NICKNAME=Nicky Nickname #
# smbd --version will then give: #
# -> "4.0.0-tp1-VendorVersion (Nicky Nickname)" #
########################################################
@@ -99,21 +99,9 @@ SAMBA_VERSION_RELEASE_NICKNAME=
# #
# Note the '-' is automaticaly added #
# #
-# e.g. SAMBA_VERSION_VENDOR_SUFFIX="VendorVersion" #
+# e.g. SAMBA_VERSION_VENDOR_SUFFIX=VendorVersion #
# -> "CVS 3.0.0rc2-VendorVersion" #
# #
-# Note: If you want to use a function, #
-# then patch lib/version.c and add this function #
-# there, because the symbol must be available in #
-# binary. #
-# #
-# const char *vendor_version(void) #
-# { #
-# return "VendorVersion"; #
-# } #
-# #
-# e.g. SAMBA_VERSION_VENDOR_SUFFIX=vendor_version() #
-# -> "CVS 3.0.0rc2-VendorVersion" #
########################################################
SAMBA_VERSION_VENDOR_SUFFIX=
SAMBA_VERSION_VENDOR_PATCH=
diff --git a/source4/lib/version.c b/source4/lib/version.c
index b7aa81a081..0ad6a93322 100644
--- a/source4/lib/version.c
+++ b/source4/lib/version.c
@@ -24,40 +24,5 @@
const char *samba_version_string(void)
{
- const char *official_string = SAMBA_VERSION_OFFICIAL_STRING;
-#ifdef SAMBA_VERSION_RELEASE_NICKNAME
- const char *release_nickname = SAMBA_VERSION_RELEASE_NICKNAME;
-#else
- const char *release_nickname = NULL;
-#endif
-#ifdef SAMBA_VERSION_VENDOR_SUFFIX
- const char *vendor_suffix = SAMBA_VERSION_VENDOR_SUFFIX;
-#else
- const char *vendor_suffix = NULL;
-#endif
-#ifdef SAMBA_VERSION_VENDOR_PATCH
- const char *vendor_patch = SAMBA_VERSION_VENDOR_PATCH;
-#else
- const char *vendor_patch = NULL;
-#endif
- static char *samba_version;
- static BOOL init_samba_version;
-
- if (init_samba_version) {
- return samba_version;
- }
-
- samba_version = talloc_asprintf(talloc_autofree_context(),
- "%s%s%s%s%s%s%s%s",
- official_string,
- (vendor_suffix?"-":""),
- (vendor_suffix?vendor_suffix:""),
- (vendor_patch?"-":""),
- (vendor_patch?vendor_patch:""),
- (release_nickname?" (":""),
- (release_nickname?release_nickname:""),
- (release_nickname?")":""));
-
- init_samba_version = True;
- return samba_version;
+ return SAMBA_VERSION_STRING;
}
diff --git a/source4/script/mkversion.sh b/source4/script/mkversion.sh
index 7995027998..0dd80712ff 100755
--- a/source4/script/mkversion.sh
+++ b/source4/script/mkversion.sh
@@ -93,38 +93,30 @@ if test x"${SAMBA_VERSION_IS_SVN_SNAPSHOT}" = x"yes";then
LANG=${_SAVE_LANG}
fi
-##
-## Add a release nickname
-##
-if test -n "${SAMBA_VERSION_RELEASE_NICKNAME}";then
- echo "#define SAMBA_VERSION_RELEASE_NICKNAME ${SAMBA_VERSION_RELEASE_NICKNAME}" >> $OUTPUT_FILE
-fi
+echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
##
## Add the vendor string if present
##
if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
echo "#define SAMBA_VERSION_VENDOR_SUFFIX ${SAMBA_VERSION_VENDOR_SUFFIX}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_SUFFIX}"
if test -n "${SAMBA_VERSION_VENDOR_PATCH}";then
echo "#define SAMBA_VERSION_VENDOR_PATCH ${SAMBA_VERSION_VENDOR_PATCH}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_PATCH}"
fi
fi
-echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
-
-echo "#define SAMBA_VERSION_STRING samba_version_string()" >> $OUTPUT_FILE
-
-echo "$0: 'version.h' created for Samba(\"${SAMBA_VERSION_STRING}\")"
-
+##
+## Add a release nickname
+##
if test -n "${SAMBA_VERSION_RELEASE_NICKNAME}";then
- echo "$0: with RELEASE_NICKNAME = ${SAMBA_VERSION_RELEASE_NICKNAME}"
+ echo "#define SAMBA_VERSION_RELEASE_NICKNAME ${SAMBA_VERSION_RELEASE_NICKNAME}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING} (${SAMBA_VERSION_RELEASE_NICKNAME})"
fi
-if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
- echo "$0: with VENDOR_SUFFIX = ${SAMBA_VERSION_VENDOR_SUFFIX}"
- if test -n "${SAMBA_VERSION_VENDOR_PATCH}";then
- echo "$0: with VENDOR_PATCH = ${SAMBA_VERSION_VENDOR_PATCH}"
- fi
-fi
+echo "#define SAMBA_VERSION_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
+
+echo "$0: 'version.h' created for Samba(\"${SAMBA_VERSION_STRING}\")"
exit 0