1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

param: correctly use param_table.c as a regular C file

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Garming Sam 2014-02-24 12:31:43 +13:00 committed by Jeremy Allison
parent db19d74479
commit ad09b3e608
6 changed files with 23 additions and 13 deletions

View File

@ -75,13 +75,7 @@ static bool defaults_saved = false;
#include "lib/param/param_global.h"
#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
#ifndef N_
#define N_(x) x
#endif
#include "lib/param/param_table.c"
#define NUMPARAMETERS (num_parameters())
struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx)
{

View File

@ -84,6 +84,8 @@ struct parm_struct {
} def;
};
extern struct parm_struct parm_table[];
struct file_lists {
struct file_lists *next;
char *name;
@ -282,6 +284,8 @@ int getservicebyname(const char *, struct loadparm_service *);
bool lp_include(struct loadparm_context *, int, const char *, char **);
void init_printer_values(TALLOC_CTX *, struct loadparm_service *);
int num_parameters(void);
/**
* Check if two parameters are equal.
*/

View File

@ -27,6 +27,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "lib/param/param.h"
#include "lib/param/loadparm.h"
#include "lib/param/param_global.h"
#include "libcli/smb/smb_constants.h"
#ifndef N_
#define N_(x) x
#endif
static const struct enum_list enum_protocol[] = {
{PROTOCOL_SMB2_10, "SMB2"}, /* for now keep PROTOCOL_SMB2_10 */
{PROTOCOL_SMB3_00, "SMB3"}, /* for now keep PROTOCOL_SMB3_00 */
@ -276,7 +286,7 @@ static const struct enum_list enum_case[] = {
#define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
static struct parm_struct parm_table[] = {
struct parm_struct parm_table[] = {
{N_("Base Options"), P_SEP, P_SEPARATOR},
{
@ -4398,3 +4408,7 @@ static struct parm_struct parm_table[] = {
{NULL, P_BOOL, P_NONE, 0, NULL, NULL, 0}
};
int num_parameters(void)
{
return (sizeof(parm_table) / sizeof(struct parm_struct));
}

View File

@ -30,7 +30,7 @@ bld.SAMBA_LIBRARY('server-role',
private_library=True)
bld.SAMBA_LIBRARY('samba-hostconfig',
source='loadparm.c generic.c util.c',
source='loadparm.c generic.c util.c param_table.c',
pc_files='samba-hostconfig.pc',
vnum='0.0.1',
deps='DYNCONFIG server-role tdb',

View File

@ -66,7 +66,7 @@ def get_implementation_parameters(sourcedir):
# burn through the preceding lines
while True:
l = f.readline()
if l.startswith("static struct parm_struct parm_table"):
if l.startswith("struct parm_struct parm_table"):
break
for l in f.readlines():

View File

@ -258,15 +258,13 @@ static bool bInGlobalSection = true;
static bool bGlobalOnly = false;
static struct file_lists *file_lists = NULL;
#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
#define NUMPARAMETERS (num_parameters())
static void set_allowed_client_auth(void);
static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
static void free_param_opts(struct parmlist_entry **popts);
#include "lib/param/param_table.c"
/* this is used to prevent lots of mallocs of size 1 */
static const char null_string[] = "";