1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3: make better use of ccache by not including version.h in every C-file.

version.h changes rather frequently. Since it is included via includes.h,
this means each C file will be a cache miss. This applies to the following
situations:

* When building a new package with a new Samba version

* building in a git branch after calling mkversion.sh
  after a new commit (i.e. virtually always)

This patch improves the situation in the following way:

* remove inlude "version.h" from includes.h

* Use samba_version_string() instead of SAMBA_VERSION_STRING
  in files that use no other macro from version.h instead of
  SAMBA_VERSION_STRING.

* explicitly include "version.h" in those files that use more
  macros from "version.h" than just SAMBA_VERSION_STRING.

Michael
This commit is contained in:
Michael Adam 2009-01-15 22:27:52 +01:00
parent da656c2e87
commit 39ec8791f8
18 changed files with 17 additions and 17 deletions

View File

@ -4974,7 +4974,7 @@ static int do_message_op(struct user_auth_info *auth_info)
cli_cm_set_credentials(auth_info);
DEBUG(3,("Client started (version %s).\n", SAMBA_VERSION_STRING));
DEBUG(3,("Client started (version %s).\n", samba_version_string()));
if (tar_type) {
if (cmdstr)

View File

@ -594,7 +594,6 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
#include "dynconfig.h"
#include "util_getent.h"
#include "debugparse.h"
#include "version.h"
#include "privileges.h"
#include "messages.h"
#include "locking.h"

View File

@ -38,7 +38,7 @@ static void fault_report(int sig)
counter++;
DEBUGSEP(0);
DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)sys_getpid(),SAMBA_VERSION_STRING));
DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)sys_getpid(),samba_version_string()));
DEBUG(0,("\nPlease read the Trouble-Shooting section of the Samba3-HOWTO\n"));
DEBUG(0,("\nFrom: http://www.samba.org/samba/docs/Samba3-HOWTO.pdf\n"));
DEBUGSEP(0);

View File

@ -73,7 +73,7 @@ static void popt_common_callback(poptContext con,
if (reason == POPT_CALLBACK_REASON_POST) {
if (PrintSambaVersionString) {
printf( "Version %s\n", SAMBA_VERSION_STRING);
printf( "Version %s\n", samba_version_string());
exit(0);
}

View File

@ -659,7 +659,7 @@ char *alloc_sub_basic(const char *smb_name, const char *domain_name,
: "");
break;
case 'v' :
a_string = realloc_string_sub(a_string, "%v", SAMBA_VERSION_STRING);
a_string = realloc_string_sub(a_string, "%v", samba_version_string());
break;
case 'w' :
a_string = realloc_string_sub(a_string, "%w", lp_winbind_separator());

View File

@ -19,7 +19,7 @@
*/
#include "includes.h"
#include <assert.h>
#include "version.h"
const char *samba_version_string(void)
{

View File

@ -470,7 +470,7 @@ static ADS_STATUS libnet_join_set_os_attributes(TALLOC_CTX *mem_ctx,
return ADS_ERROR(LDAP_NO_MEMORY);
}
os_sp = talloc_asprintf(mem_ctx, "Samba %s", SAMBA_VERSION_STRING);
os_sp = talloc_asprintf(mem_ctx, "Samba %s", samba_version_string());
if (!os_sp) {
return ADS_ERROR(LDAP_NO_MEMORY);
}

View File

@ -224,7 +224,7 @@ static NTSTATUS cli_session_setup_plaintext(struct cli_state *cli,
char *p;
fstring lanman;
fstr_sprintf( lanman, "Samba %s", SAMBA_VERSION_STRING);
fstr_sprintf( lanman, "Samba %s", samba_version_string());
memset(cli->outbuf, '\0', smb_size);
cli_set_message(cli->outbuf,13,0,True);

View File

@ -619,7 +619,7 @@ smbc_init_context(SMBCCTX *context)
const char *
smbc_version(void)
{
return SAMBA_VERSION_STRING;
return samba_version_string();
}

View File

@ -847,7 +847,7 @@ static bool open_sockets(bool isdaemon, int port)
reopen_logs();
DEBUG(0,("nmbd version %s started.\n", SAMBA_VERSION_STRING));
DEBUG(0,("nmbd version %s started.\n", samba_version_string()));
DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {

View File

@ -4773,7 +4773,7 @@ static void init_globals(bool first_time_only)
string_set(&Globals.szPidDir, get_dyn_PIDDIR());
string_set(&Globals.szSocketAddress, "0.0.0.0");
if (asprintf(&s, "Samba %s", SAMBA_VERSION_STRING) < 0) {
if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
smb_panic("init_globals: ENOMEM");
}
string_set(&Globals.szServerString, s);

View File

@ -1231,7 +1231,7 @@ extern void build_options(bool screen);
reopen_logs();
DEBUG(0,("smbd version %s started.\n", SAMBA_VERSION_STRING));
DEBUG(0,("smbd version %s started.\n", samba_version_string()));
DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",

View File

@ -71,7 +71,7 @@ static int push_signature(uint8 **outbuf)
if (tmp == -1) return -1;
result += tmp;
if (asprintf(&lanman, "Samba %s", SAMBA_VERSION_STRING) != -1) {
if (asprintf(&lanman, "Samba %s", samba_version_string()) != -1) {
tmp = message_push_string(outbuf, lanman, STR_TERMINATE);
SAFE_FREE(lanman);
}

View File

@ -24,6 +24,7 @@
*/
#include "includes.h"
#include "version.h"
#include "smbd/globals.h"
extern enum protocol_types Protocol;

View File

@ -406,7 +406,7 @@ static int traverse_sessionid(struct db_record *db, void *state)
if (!db) {
d_printf("sessionid.tdb not initialised\n");
} else {
d_printf("\nSamba version %s\n",SAMBA_VERSION_STRING);
d_printf("\nSamba version %s\n",samba_version_string());
d_printf("PID Username Group Machine \n");
d_printf("-------------------------------------------------------------------\n");

View File

@ -345,7 +345,7 @@ void status_page(void)
printf("<table>\n");
printf("<tr><td>%s</td><td>%s</td></tr>", _("version:"), SAMBA_VERSION_STRING);
printf("<tr><td>%s</td><td>%s</td></tr>", _("version:"), samba_version_string());
fflush(stdout);
printf("<tr><td>%s</td><td>%s</td>\n", _("smbd:"), smbd_running()?_("running"):_("not running"));

View File

@ -1121,7 +1121,7 @@ int main(int argc, char **argv, char **envp)
setup_logging("winbindd", log_stdout);
reopen_logs();
DEBUG(0,("winbindd version %s started.\n", SAMBA_VERSION_STRING));
DEBUG(0,("winbindd version %s started.\n", samba_version_string()));
DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE));
if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {

View File

@ -742,7 +742,7 @@ void winbindd_info(struct winbindd_cli_state *state)
DEBUG(3, ("[%5lu]: request misc info\n", (unsigned long)state->pid));
state->response.data.info.winbind_separator = *lp_winbind_separator();
fstrcpy(state->response.data.info.samba_version, SAMBA_VERSION_STRING);
fstrcpy(state->response.data.info.samba_version, samba_version_string());
request_ok(state);
}