|
@@ -15,9 +15,13 @@
|
15
|
15
|
* along with this program; if not, write to the Free Software
|
16
|
16
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
17
|
17
|
* 02110-1301, USA.
|
|
18
|
+ *
|
|
19
|
+ * You can also choose to distribute this program under the terms of
|
|
20
|
+ * the Unmodified Binary Distribution Licence (as given in the file
|
|
21
|
+ * COPYING.UBDL), provided that you have satisfied its requirements.
|
18
|
22
|
*/
|
19
|
23
|
|
20
|
|
-FILE_LICENCE ( GPL2_OR_LATER );
|
|
24
|
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
21
|
25
|
|
22
|
26
|
#include <stdint.h>
|
23
|
27
|
#include <stdlib.h>
|
|
@@ -337,17 +341,20 @@ struct settings * autovivify_child_settings ( struct settings *parent,
|
337
|
341
|
*/
|
338
|
342
|
const char * settings_name ( struct settings *settings ) {
|
339
|
343
|
static char buf[16];
|
340
|
|
- char tmp[ sizeof ( buf ) ];
|
|
344
|
+ char tmp[ 1 /* '.' */ + sizeof ( buf ) ];
|
341
|
345
|
|
342
|
346
|
/* Find target settings block */
|
343
|
347
|
settings = settings_target ( settings );
|
344
|
348
|
|
345
|
349
|
/* Construct name */
|
346
|
|
- for ( buf[2] = buf[0] = 0 ; settings ; settings = settings->parent ) {
|
347
|
|
- memcpy ( tmp, buf, sizeof ( tmp ) );
|
348
|
|
- snprintf ( buf, sizeof ( buf ), ".%s%s", settings->name, tmp );
|
|
350
|
+ buf[0] = '\0';
|
|
351
|
+ tmp[0] = '\0';
|
|
352
|
+ for ( ; settings->parent ; settings = settings->parent ) {
|
|
353
|
+ memcpy ( ( tmp + 1 ), buf, ( sizeof ( tmp ) - 1 ) );
|
|
354
|
+ snprintf ( buf, sizeof ( buf ), "%s%s", settings->name, tmp );
|
|
355
|
+ tmp[0] = '.';
|
349
|
356
|
}
|
350
|
|
- return ( buf + 2 );
|
|
357
|
+ return buf;
|
351
|
358
|
}
|
352
|
359
|
|
353
|
360
|
/**
|