Il 02/10/2013 22:24, Stefan Weil ha scritto: > Am 02.10.2013 21:02, schrieb Michael Tokarev: > MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp) > { > MigrationCapabilityStatusList *head = NULL; > MigrationCapabilityStatusList *prev = NULL; > MigrationState *s = migrate_get_current(); > MigrationCapability i; > > for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) { > MigrationCapabilityStatusList *caps = > g_new(MigrationCapabilityStatusList, 1); > if (prev == NULL) { > head = caps; > } else { > prev->next = caps; > prev = caps; > } > caps->value = g_new(MigrationCapabilityStatus, 1); > caps->value->capability = i; > caps->value->state = s->enabled_capabilities[i]; > } > > return head; > }
I dislike having head initialized to NULL. > Which one do we take? Any correct solution which fixes the compiler > warning is fine for me (although I prefer g_new instead of g_malloc as > you might have guessed). :-) Mine uses g_new0 so it should work for you as well? :) Paolo