fpi-context: Make fpi_get_driver_types to return an array

No need to create one all the times and the fill it with what we need.
This commit is contained in:
Marco Trevisan (Treviño)
2019-12-14 16:56:15 +01:00
parent 8184e33dd6
commit 09576e5209
5 changed files with 11 additions and 16 deletions

View File

@@ -151,21 +151,20 @@ drivers_type_func = []
drivers_type_list += '#include <glib-object.h>'
drivers_type_list += '#include "fpi-context.h"'
drivers_type_list += ''
drivers_type_func += 'void fpi_get_driver_types (GArray *drivers)'
drivers_type_func += 'GArray *'
drivers_type_func += 'fpi_get_driver_types (void)'
drivers_type_func += '{'
drivers_type_func += ' GArray *drivers = g_array_new (TRUE, FALSE, sizeof (GType));'
drivers_type_func += ' GType t;'
drivers_type_func += ''
idx = 0
foreach driver: drivers
drivers_type_list += 'extern GType (fpi_device_' + driver + '_get_type) (void);'
drivers_type_func += ' t = fpi_device_' + driver + '_get_type ();'
drivers_type_func += ' g_array_append_val (drivers, t);'
if idx != drivers.length() - 1
drivers_type_func += ''
idx += 1
endif
drivers_type_func += ''
endforeach
drivers_type_list += ''
drivers_type_func += ' return drivers;'
drivers_type_func += '}'
root_inc = include_directories('.')