Skip to content

Commit

Permalink
Removed 'mg_spec*()' functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanem committed Jan 31, 2025
1 parent 9d63c03 commit b06ae01
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/Makefile.Windows
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ endef
define func_exports
$(foreach e, $(1), -export:mg_unpack_$(e))
$(foreach e, $(1), -export:mg_unlist_$(e))
$(foreach e, $(1), -export:mg_spec_$(e))
endef

#
Expand Down
13 changes: 1 addition & 12 deletions src/net_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ static uint32_t num_lookups, num_misses;
* Define the func-ptr to the `mg_unpack()` + `mg_unlist()` functions loaded
* dynamically from the `web-page = some.dll;N` config-file setting.
*/

DEF_C_FUNC (const char *, mg_unpack, (const char *name, size_t *size, time_t *mtime));
DEF_C_FUNC (const char *, mg_unlist, (size_t i));
DEF_C_FUNC (const char *, mg_spec, (void));

/**
* For handling denial of clients in `client_handler (.., MG_EV_ACCEPT)` .
Expand Down Expand Up @@ -1724,8 +1722,7 @@ bool net_set_host_port (const char *host_port, net_service *serv, uint16_t def_p

static struct dyn_struct web_page_funcs [] = {
ADD_FUNC (mg_unpack),
ADD_FUNC (mg_unlist),
ADD_FUNC (mg_spec)
ADD_FUNC (mg_unlist)
};
static char *web_funcs [DIM(web_page_funcs)];

Expand Down Expand Up @@ -1886,14 +1883,6 @@ bool net_set_host_port (const char *host_port, net_service *serv, uint16_t def_p
return (true);
}

/*
* Returns the `spec` used to generate the "Packed Web" files.
*/
const char *mg_spec (void)
{
return (*p_mg_spec)();
}

/*
* This is called from 'externals/mongoose.c' when using a packed File-system.
* I.e. when `opts.fs = &mg_fs_packed;` above.
Expand Down
23 changes: 9 additions & 14 deletions tools/gen_packed_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
}
return (NULL);
}
const char *mg_spec%s (void)
{
return ("%s");
}
"""

def trace (level, s):
Expand Down Expand Up @@ -205,14 +200,14 @@ def show_help (error=None):

def parse_cmdline():
parser = argparse.ArgumentParser (add_help = False)
parser.add_argument ("-h", "--help", dest = "help", action = "store_true")
parser.add_argument ("-i", "--ignore", action = "append", default = [])
parser.add_argument ("-m", "--minify", dest = "minify", action = "store_true")
parser.add_argument ("-o", "--outfile", dest = "outfile", type = str)
parser.add_argument ("-r", "--recursive", dest = "recursive", action = "store_true")
parser.add_argument ("-s", "--strip", dest = "strip", default = "")
parser.add_argument ("-S", "--suffix", dest = "suffix", default = "")
parser.add_argument ("-v", "--verbose", dest = "verbose", action = "count", default = 0)
parser.add_argument ("-h", "--help", dest = "help", action = "store_true")
parser.add_argument ("-i", "--ignore", action = "append", default = [])
parser.add_argument ("-m", "--minify", dest = "minify", action = "store_true")
parser.add_argument ("-o", "--outfile", dest = "outfile", type = str)
parser.add_argument ("-r", "--recursive", dest = "recursive", action = "store_true")
parser.add_argument ("-s", "--strip", dest = "strip", default = "")
parser.add_argument ("-S", "--suffix", dest = "suffix", default = "")
parser.add_argument ("-v", "--verbose", dest = "verbose", action = "count", default = 0)
parser.add_argument ("spec", nargs = argparse.REMAINDER)
return parser.parse_args()

Expand Down Expand Up @@ -285,7 +280,7 @@ def parse_cmdline():
out.write (C_ARRAY)
write_packed_files_array (out)

out.write (C_BOTTOM % (opt.suffix, opt.suffix, opt.suffix, opt.spec))
out.write (C_BOTTOM % (opt.suffix, opt.suffix))
out.close()

if opt.minify:
Expand Down

0 comments on commit b06ae01

Please sign in to comment.