@@ -328,35 +328,38 @@ char *time_pos_str(r_cfg_t *cfg, unsigned samples_ago, char *buf)
328
328
// well-known field "protocol" is only used when model protocol is requested
329
329
// well-known field "description" is only used when model description is requested
330
330
// well-known fields "mod", "freq", "freq1", "freq2", "rssi", "snr", "noise" are used by meta report option
331
- static char const * well_known_default [15 ] = {0 };
332
331
char const * * well_known_output_fields (r_cfg_t * cfg )
333
332
{
334
- char const * * p = well_known_default ;
335
- * p ++ = "time" ;
336
- * p ++ = "msg" ;
337
- * p ++ = "codes" ;
333
+ list_t field_list = {0 };
334
+ list_ensure_size (& field_list , 15 );
335
+
336
+ list_push (& field_list , "time" );
337
+ list_push (& field_list , "msg" );
338
+ list_push (& field_list , "codes" );
338
339
339
340
if (cfg -> verbose_bits )
340
- * p ++ = "bits" ;
341
+ list_push (& field_list , "bits" );
342
+
341
343
for (void * * iter = cfg -> data_tags .elems ; iter && * iter ; ++ iter ) {
342
344
data_tag_t * tag = * iter ;
343
- * p ++ = tag -> key ;
345
+ list_push ( & field_list , tag -> key ) ;
344
346
}
347
+
345
348
if (cfg -> report_protocol )
346
- * p ++ = "protocol" ;
349
+ list_push ( & field_list , "protocol" ) ;
347
350
if (cfg -> report_description )
348
- * p ++ = "description" ;
351
+ list_push ( & field_list , "description" ) ;
349
352
if (cfg -> report_meta ) {
350
- * p ++ = "mod" ;
351
- * p ++ = "freq" ;
352
- * p ++ = "freq1" ;
353
- * p ++ = "freq2" ;
354
- * p ++ = "rssi" ;
355
- * p ++ = "snr" ;
356
- * p ++ = "noise" ;
353
+ list_push ( & field_list , "mod" ) ;
354
+ list_push ( & field_list , "freq" ) ;
355
+ list_push ( & field_list , "freq1" ) ;
356
+ list_push ( & field_list , "freq2" ) ;
357
+ list_push ( & field_list , "rssi" ) ;
358
+ list_push ( & field_list , "snr" ) ;
359
+ list_push ( & field_list , "noise" ) ;
357
360
}
358
361
359
- return well_known_default ;
362
+ return ( char const * * ) field_list . elems ;
360
363
}
361
364
362
365
/** Convert CSV keys according to selected conversion mode. Replacement is static but in-place. */
0 commit comments