size reduction by using specialized entry funcs

This commit is contained in:
2018-03-03 11:05:16 +01:00
parent 78897f84b3
commit ed7a4c80a0
16 changed files with 149 additions and 82 deletions
+19
View File
@@ -119,6 +119,25 @@ void iw_entry(IniWriter *iw, const char *key, const char *format, ...)
iw_newline(iw); // one newline after entry
}
void iw_entry_s(IniWriter *iw, const char *key, const char *value)
{
if (iw->count == 0) return;
iw_string(iw, key);
iw_string(iw, "=");
iw_string(iw, value);
iw_newline(iw);
}
void iw_entry_d(IniWriter *iw, const char *key, int32_t value)
{
if (iw->count == 0) return;
iw_string(iw, key);
iw_string(iw, "=");
uint32_t len = (int)fixup_snprintf(&iwbuffer[0], IWBUFFER_LEN, "%d", value);
iw_buff(iw, (uint8_t *) iwbuffer, len);
iw_newline(iw);
}
uint32_t iw_measure_total(void (*handler)(IniWriter *), uint32_t tag)
{
IniWriter iw = iw_init(NULL, 0xFFFFFFFF, 1);
+3
View File
@@ -126,6 +126,9 @@ __attribute__((format(printf,2,3)));
void iw_entry(IniWriter *iw, const char *key, const char *format, ...)
__attribute__((format(printf,3,4)));
void iw_entry_s(IniWriter *iw, const char *key, const char *value);
void iw_entry_d(IniWriter *iw, const char *key, int32_t value);
/**
* Measure total ini writer length using a dummy write
*