1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

libcli: Shrink .data segment by 43264 bytes

A case statement only references const strings, pointers in an array
need to be relocated at exec() time.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2023-02-28 20:53:59 +01:00 committed by Jeremy Allison
parent e6a03c04a7
commit 43b34b0159
2 changed files with 9 additions and 14 deletions

View File

@ -32,8 +32,6 @@ struct werror_str_struct {
const char *friendly_errstr;
};
#include "werror_gen.c"
static const struct werror_code_struct special_errs[] =
{
{ "WERR_DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD", WERR_DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD },
@ -108,11 +106,10 @@ const char *win_errstr(WERROR werror)
idx = 0;
while (dos_errs[idx].dos_errstr != NULL) {
if (W_ERROR_V(dos_errs[idx].werror) ==
W_ERROR_V(werror))
return dos_errs[idx].dos_errstr;
idx++;
switch W_ERROR_V(werror) {
#include "werror_gen.c"
default:
break;
}
slprintf(msg, sizeof(msg), "DOS code 0x%08x", W_ERROR_V(werror));

View File

@ -37,19 +37,17 @@ def generateHeaderFile(out_file, errors):
out_file.write("\n#endif /* _WERR_GEN_H */\n")
def generateSourceFile(out_file, errors):
out_file.write("#include \"werror.h\"\n")
out_file.write("/*\n")
out_file.write(" * Names for errors generated from\n")
out_file.write(" * [MS-ERREF] https://msdn.microsoft.com/en-us/library/cc231199.aspx\n")
out_file.write(" */\n")
out_file.write("static const struct werror_code_struct dos_errs[] = \n")
out_file.write("{\n")
for err in errors:
out_file.write("\t{ \"%s\", %s },\n" % (err.err_define, err.err_define))
out_file.write("{ 0, W_ERROR(0) }\n")
out_file.write("};\n")
if (err.err_define == 'WERR_NERR_SUCCESS'):
continue
out_file.write(f'\t case {hex(err.err_code)}:\n')
out_file.write(f'\t\treturn \"{err.err_define}\";\n')
out_file.write(f'\t\tbreak;\n')
def generateFriendlySourceFile(out_file, errors):
out_file.write("/*\n")