Ignore:
Timestamp:
02/27/13 14:34:37 (9 years ago)
Author:
gf
Message:

webif: Remove the need to save config info in struct templates.

Configuration data for templates was introduced in commit r7221
as a way to fix ticket #2665.

Basically we kept the configuration deps in the template and when we
loaded the template from file we checked if the config items are enabled.
If they weren't we ignorred the template like it didn't exist.

But now there is a better way. If config item was disabled when the
binary was built then the template does not exist in struct templates
at all.

So we can just check if the requested template exists in struct templates,
and if it doesn't exists we just don't try to load it from file, so the
problem in ticket #2665 is still solved but we remove lots of code (one
less place place that knows about configuration items, yay!) and lower
the binary size by ~1.4k.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webif/pages_gen.c

    r8434 r8435  
    241241    }
    242242
    243     fprintf(output_file, "\t{ .tpl_name=\"%s\", .tpl_data=%s%s, .tpl_deps=\"%s\", .tpl_data_len=%u },\n",
     243    fprintf(output_file, "\t{ .tpl_name=\"%s\", .tpl_data=%s%s, .tpl_data_len=%u },\n",
    244244        ident,
    245245        templates.data[tpl_idx].type == TXT ? "TPL" : "", ident,
    246         deps,
    247246        templates.data[tpl_idx].data_len
    248247    );
     
    317316    fprintf(output_file, "  char *tpl_name;\n");
    318317    fprintf(output_file, "  char *tpl_data;\n");
    319     fprintf(output_file, "  char *tpl_deps;\n");
    320318    fprintf(output_file, "  uint32_t tpl_data_len;\n");
    321319    fprintf(output_file, "};\n");
Note: See TracChangeset for help on using the changeset viewer.