mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
param_export: reduce bson buffer size from 512 to 256
Some modules call this (and maybe in rare circumstances), which could lead to stack overflows. With our current headroom of >= 300bytes, 256 should be ok. This increases the export time from ~28ms to ~34ms in my case (on a Pixracer)
This commit is contained in:
@@ -1048,7 +1048,7 @@ param_export(int fd, bool only_unsaved)
|
||||
|
||||
param_lock_reader();
|
||||
|
||||
uint8_t bson_buffer[512];
|
||||
uint8_t bson_buffer[256];
|
||||
bson_encoder_init_buf(&encoder, &bson_buffer, sizeof(bson_buffer));
|
||||
|
||||
/* no modified parameters -> we are done */
|
||||
|
||||
@@ -299,6 +299,7 @@ __EXPORT void param_reset_excludes(const char *excludes[], int num_excludes);
|
||||
|
||||
/**
|
||||
* Export changed parameters to a file.
|
||||
* Note: this method requires a large amount of stack size!
|
||||
*
|
||||
* @param fd File descriptor to export to.
|
||||
* @param only_unsaved Only export changed parameters that have not yet been exported.
|
||||
@@ -365,6 +366,7 @@ __EXPORT const char *param_get_default_file(void);
|
||||
|
||||
/**
|
||||
* Save parameters to the default file.
|
||||
* Note: this method requires a large amount of stack size!
|
||||
*
|
||||
* This function saves all parameters with non-default values.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user