X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fpkgmgrinfo_basic.c;h=ed2f427ee9ab56180f591d496cd10afaac41d0f7;hb=50e488484683e5df4292c89c9caa53307ec4a0e2;hp=c72cad268bda23bb73d04bef9722c3be2d82d67c;hpb=a69fcd925ede6c418b959fa1c2af77bc1082d809;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git diff --git a/src/pkgmgrinfo_basic.c b/src/pkgmgrinfo_basic.c index c72cad2..ed2f427 100644 --- a/src/pkgmgrinfo_basic.c +++ b/src/pkgmgrinfo_basic.c @@ -3,304 +3,91 @@ #include "pkgmgrinfo_basic.h" #include "pkgmgrinfo_private.h" -static void __ps_free_category(category_x *category) -{ - if (category == NULL) - return; - if (category->name) { - free((void *)category->name); - category->name = NULL; - } - free((void*)category); - category = NULL; -} - -static void __ps_free_privilege(privilege_x *privilege) -{ - if (privilege == NULL) - return; - if (privilege->text) { - free((void *)privilege->text); - privilege->text = NULL; - } - free((void*)privilege); - privilege = NULL; -} - -static void __ps_free_privileges(privileges_x *privileges) -{ - if (privileges == NULL) - return; - /*Free Privilege*/ - if (privileges->privilege) { - privilege_x *privilege = privileges->privilege; - privilege_x *tmp = NULL; - while(privilege != NULL) { - tmp = privilege->next; - __ps_free_privilege(privilege); - privilege = tmp; - } - } - free((void*)privileges); - privileges = NULL; -} - -static void __ps_free_metadata(metadata_x *metadata) +static void __ps_free_metadata(gpointer data) { + metadata_x *metadata = (metadata_x *)data; if (metadata == NULL) return; - if (metadata->key) { + if (metadata->key) free((void *)metadata->key); - metadata->key = NULL; - } - if (metadata->value) { + if (metadata->value) free((void *)metadata->value); - metadata->value = NULL; - } - free((void*)metadata); - metadata = NULL; + free((void *)metadata); } -static void __ps_free_permission(permission_x *permission) +static void __ps_free_permission(gpointer data) { + permission_x *permission = (permission_x *)data; if (permission == NULL) return; - if (permission->type) { + if (permission->type) free((void *)permission->type); - permission->type = NULL; - } - if (permission->value) { + if (permission->value) free((void *)permission->value); - permission->value = NULL; - } - free((void*)permission); - permission = NULL; + free((void *)permission); } -static void __ps_free_icon(icon_x *icon) +static void __ps_free_icon(gpointer data) { + icon_x *icon = (icon_x *)data; if (icon == NULL) return; - if (icon->text) { + if (icon->text) free((void *)icon->text); - icon->text = NULL; - } - if (icon->lang) { + if (icon->lang) free((void *)icon->lang); - icon->lang = NULL; - } - if (icon->name) { - free((void *)icon->name); - icon->name= NULL; - } - if (icon->section) { + if (icon->section) free((void *)icon->section); - icon->section = NULL; - } - if (icon->size) { + if (icon->size) free((void *)icon->size); - icon->size = NULL; - } - if (icon->resolution) { + if (icon->resolution) free((void *)icon->resolution); - icon->resolution = NULL; - } - free((void*)icon); - icon = NULL; + if (icon->dpi) + free((void *)icon->dpi); + free((void *)icon); } -static void __ps_free_image(image_x *image) +static void __ps_free_image(gpointer data) { + image_x *image = (image_x *)data; if (image == NULL) return; - if (image->text) { + if (image->text) free((void *)image->text); - image->text = NULL; - } - if (image->lang) { + if (image->lang) free((void *)image->lang); - image->lang = NULL; - } - if (image->name) { - free((void *)image->name); - image->name= NULL; - } - if (image->section) { + if (image->section) free((void *)image->section); - image->section = NULL; - } - free((void*)image); - image = NULL; -} - -static void __ps_free_operation(operation_x *operation) -{ - if (operation == NULL) - return; - if (operation->text) { - free((void *)operation->text); - operation->text = NULL; - } - free((void*)operation); - operation = NULL; -} - -static void __ps_free_uri(uri_x *uri) -{ - if (uri == NULL) - return; - if (uri->text) { - free((void *)uri->text); - uri->text = NULL; - } - free((void*)uri); - uri = NULL; -} - -static void __ps_free_mime(mime_x *mime) -{ - if (mime == NULL) - return; - if (mime->text) { - free((void *)mime->text); - mime->text = NULL; - } - free((void*)mime); - mime = NULL; -} - -static void __ps_free_subapp(subapp_x *subapp) -{ - if (subapp == NULL) - return; - if (subapp->text) { - free((void *)subapp->text); - subapp->text = NULL; - } - free((void*)subapp); - subapp = NULL; + free((void *)image); } -static void __ps_free_condition(condition_x *condition) -{ - if (condition == NULL) - return; - if (condition->text) { - free((void *)condition->text); - condition->text = NULL; - } - if (condition->name) { - free((void *)condition->name); - condition->name = NULL; - } - free((void*)condition); - condition = NULL; -} - -static void __ps_free_notification(notification_x *notification) +static void __ps_free_notification(gpointer data) { + notification_x *notification = (notification_x *)data; if (notification == NULL) return; - if (notification->text) { + if (notification->text) free((void *)notification->text); - notification->text = NULL; - } - if (notification->name) { + if (notification->name) free((void *)notification->name); - notification->name = NULL; - } - free((void*)notification); - notification = NULL; + free((void *)notification); } -static void __ps_free_compatibility(compatibility_x *compatibility) +static void __ps_free_compatibility(gpointer data) { + compatibility_x *compatibility = (compatibility_x *)data; if (compatibility == NULL) return; - if (compatibility->text) { + if (compatibility->text) free((void *)compatibility->text); - compatibility->text = NULL; - } - if (compatibility->name) { + if (compatibility->name) free((void *)compatibility->name); - compatibility->name = NULL; - } - free((void*)compatibility); - compatibility = NULL; -} - -static void __ps_free_allowed(allowed_x *allowed) -{ - if (allowed == NULL) - return; - if (allowed->name) { - free((void *)allowed->name); - allowed->name = NULL; - } - if (allowed->text) { - free((void *)allowed->text); - allowed->text = NULL; - } - free((void*)allowed); - allowed = NULL; -} - -static void __ps_free_request(request_x *request) -{ - if (request == NULL) - return; - if (request->text) { - free((void *)request->text); - request->text = NULL; - } - free((void*)request); - request = NULL; + free((void *)compatibility); } -static void __ps_free_datacontrol(datacontrol_x *datacontrol) -{ - if (datacontrol == NULL) - return; - if (datacontrol->providerid) { - free((void *)datacontrol->providerid); - datacontrol->providerid = NULL; - } - if (datacontrol->access) { - free((void *)datacontrol->access); - datacontrol->access = NULL; - } - if (datacontrol->type) { - free((void *)datacontrol->type); - datacontrol->type = NULL; - } - free((void*)datacontrol); - datacontrol = NULL; -} - -static void __ps_free_launchconditions(launchconditions_x *launchconditions) -{ - if (launchconditions == NULL) - return; - if (launchconditions->text) { - free((void *)launchconditions->text); - launchconditions->text = NULL; - } - /*Free Condition*/ - if (launchconditions->condition) { - condition_x *condition = launchconditions->condition; - condition_x *tmp = NULL; - while(condition != NULL) { - tmp = condition->next; - __ps_free_condition(condition); - condition = tmp; - } - } - free((void*)launchconditions); - launchconditions = NULL; -} - -static void __ps_free_appcontrol(appcontrol_x *appcontrol) +static void __ps_free_appcontrol(gpointer data) { + appcontrol_x *appcontrol = (appcontrol_x *)data; if (appcontrol == NULL) return; /*Free Operation*/ @@ -312,662 +99,147 @@ static void __ps_free_appcontrol(appcontrol_x *appcontrol) /*Free Mime*/ if (appcontrol->mime) free((void *)appcontrol->mime); - free((void*)appcontrol); - appcontrol = NULL; + free((void *)appcontrol); } -static void __ps_free_appsvc(appsvc_x *appsvc) +static void __ps_free_define(gpointer data) { - if (appsvc == NULL) - return; - if (appsvc->text) { - free((void *)appsvc->text); - appsvc->text = NULL; - } - /*Free Operation*/ - if (appsvc->operation) { - operation_x *operation = appsvc->operation; - operation_x *tmp = NULL; - while(operation != NULL) { - tmp = operation->next; - __ps_free_operation(operation); - operation = tmp; - } - } - /*Free Uri*/ - if (appsvc->uri) { - uri_x *uri = appsvc->uri; - uri_x *tmp = NULL; - while(uri != NULL) { - tmp = uri->next; - __ps_free_uri(uri); - uri = tmp; - } - } - /*Free Mime*/ - if (appsvc->mime) { - mime_x *mime = appsvc->mime; - mime_x *tmp = NULL; - while(mime != NULL) { - tmp = mime->next; - __ps_free_mime(mime); - mime = tmp; - } - } - /*Free subapp*/ - if (appsvc->subapp) { - subapp_x *subapp = appsvc->subapp; - subapp_x *tmp = NULL; - while(subapp != NULL) { - tmp = subapp->next; - __ps_free_subapp(subapp); - subapp = tmp; - } - } - free((void*)appsvc); - appsvc = NULL; -} - -static void __ps_free_deviceprofile(deviceprofile_x *deviceprofile) -{ - return; -} + define_x *define = (define_x *)data; -static void __ps_free_define(define_x *define) -{ if (define == NULL) return; - if (define->path) { + if (define->path) free((void *)define->path); - define->path = NULL; - } /*Free Request*/ - if (define->request) { - request_x *request = define->request; - request_x *tmp = NULL; - while(request != NULL) { - tmp = request->next; - __ps_free_request(request); - request = tmp; - } - } + g_list_free_full(define->request, free); /*Free Allowed*/ - if (define->allowed) { - allowed_x *allowed = define->allowed; - allowed_x *tmp = NULL; - while(allowed != NULL) { - tmp = allowed->next; - __ps_free_allowed(allowed); - allowed = tmp; - } - } - free((void*)define); - define = NULL; + g_list_free_full(define->allowed, free); + free((void *)define); } -static void __ps_free_datashare(datashare_x *datashare) +static void __ps_free_datashare(gpointer data) { + datashare_x *datashare = (datashare_x *)data; if (datashare == NULL) return; /*Free Define*/ - if (datashare->define) { - define_x *define = datashare->define; - define_x *tmp = NULL; - while(define != NULL) { - tmp = define->next; - __ps_free_define(define); - define = tmp; - } - } + g_list_free_full(datashare->define, __ps_free_define); /*Free Request*/ - if (datashare->request) { - request_x *request = datashare->request; - request_x *tmp = NULL; - while(request != NULL) { - tmp = request->next; - __ps_free_request(request); - request = tmp; - } - } - free((void*)datashare); - datashare = NULL; + g_list_free_full(datashare->request, free); + free((void *)datashare); } -static void __ps_free_label(label_x *label) +static void __ps_free_label(gpointer data) { + label_x *label = (label_x *)data; if (label == NULL) return; - if (label->name) { + if (label->name) free((void *)label->name); - label->name = NULL; - } - if (label->text) { + if (label->text) free((void *)label->text); - label->text = NULL; - } - if (label->lang) { + if (label->lang) free((void *)label->lang); - label->lang= NULL; - } - free((void*)label); - label = NULL; + free((void *)label); } -static void __ps_free_author(author_x *author) +static void __ps_free_author(gpointer data) { + author_x *author = (author_x *)data; if (author == NULL) return; - if (author->email) { + if (author->email) free((void *)author->email); - author->email = NULL; - } - if (author->text) { + if (author->text) free((void *)author->text); - author->text = NULL; - } - if (author->href) { + if (author->href) free((void *)author->href); - author->href = NULL; - } - if (author->lang) { + if (author->lang) free((void *)author->lang); - author->lang = NULL; - } - free((void*)author); - author = NULL; + free((void *)author); } -static void __ps_free_description(description_x *description) +static void __ps_free_description(gpointer data) { + description_x *description = (description_x *)data; if (description == NULL) return; - if (description->name) { + if (description->name) free((void *)description->name); - description->name = NULL; - } - if (description->text) { + if (description->text) free((void *)description->text); - description->text = NULL; - } - if (description->lang) { + if (description->lang) free((void *)description->lang); - description->lang = NULL; - } - free((void*)description); - description = NULL; + free((void *)description); } -static void __ps_free_license(license_x *license) +static void __ps_free_license(gpointer data) { + license_x *license = (license_x *)data; if (license == NULL) return; - if (license->text) { + if (license->text) free((void *)license->text); - license->text = NULL; - } - if (license->lang) { + if (license->lang) free((void *)license->lang); - license->lang = NULL; - } - free((void*)license); - license = NULL; + free((void *)license); } -static void __ps_free_uiapplication(uiapplication_x *uiapplication) +static void __ps_free_splashscreen(gpointer data) { - if (uiapplication == NULL) + splashscreen_x *splashscreen = (splashscreen_x *)data; + if (splashscreen == NULL) return; - if (uiapplication->exec) { - free((void *)uiapplication->exec); - uiapplication->exec = NULL; - } - if (uiapplication->appid) { - free((void *)uiapplication->appid); - uiapplication->appid = NULL; - } - if (uiapplication->nodisplay) { - free((void *)uiapplication->nodisplay); - uiapplication->nodisplay = NULL; - } - if (uiapplication->multiple) { - free((void *)uiapplication->multiple); - uiapplication->multiple = NULL; - } - if (uiapplication->type) { - free((void *)uiapplication->type); - uiapplication->type = NULL; - } - if (uiapplication->categories) { - free((void *)uiapplication->categories); - uiapplication->categories = NULL; - } - if (uiapplication->extraid) { - free((void *)uiapplication->extraid); - uiapplication->extraid = NULL; - } - if (uiapplication->taskmanage) { - free((void *)uiapplication->taskmanage); - uiapplication->taskmanage = NULL; - } - if (uiapplication->enabled) { - free((void *)uiapplication->enabled); - uiapplication->enabled = NULL; - } - if (uiapplication->hwacceleration) { - free((void *)uiapplication->hwacceleration); - uiapplication->hwacceleration = NULL; - } - if (uiapplication->screenreader) { - free((void *)uiapplication->screenreader); - uiapplication->screenreader = NULL; - } - if (uiapplication->mainapp) { - free((void *)uiapplication->mainapp); - uiapplication->mainapp = NULL; - } - if (uiapplication->recentimage) { - free((void *)uiapplication->recentimage); - uiapplication->recentimage = NULL; - } - if (uiapplication->package) { - free((void *)uiapplication->package); - uiapplication->package = NULL; - } - if (uiapplication->launchcondition) { - free((void *)uiapplication->launchcondition); - uiapplication->launchcondition = NULL; - } - /*Free Label*/ - if (uiapplication->label) { - label_x *label = uiapplication->label; - label_x *tmp = NULL; - while(label != NULL) { - tmp = label->next; - __ps_free_label(label); - label = tmp; - } - } - /*Free Icon*/ - if (uiapplication->icon) { - icon_x *icon = uiapplication->icon; - icon_x *tmp = NULL; - while(icon != NULL) { - tmp = icon->next; - __ps_free_icon(icon); - icon = tmp; - } - } - /*Free image*/ - if (uiapplication->image) { - image_x *image = uiapplication->image; - image_x *tmp = NULL; - while(image != NULL) { - tmp = image->next; - __ps_free_image(image); - image = tmp; - } - } - /*Free AppControl*/ - if (uiapplication->appcontrol) { - appcontrol_x *appcontrol = uiapplication->appcontrol; - appcontrol_x *tmp = NULL; - while(appcontrol != NULL) { - tmp = appcontrol->next; - __ps_free_appcontrol(appcontrol); - appcontrol = tmp; - } - } - /*Free LaunchConditions*/ - if (uiapplication->launchconditions) { - launchconditions_x *launchconditions = uiapplication->launchconditions; - launchconditions_x *tmp = NULL; - while(launchconditions != NULL) { - tmp = launchconditions->next; - __ps_free_launchconditions(launchconditions); - launchconditions = tmp; - } - } - /*Free Notification*/ - if (uiapplication->notification) { - notification_x *notification = uiapplication->notification; - notification_x *tmp = NULL; - while(notification != NULL) { - tmp = notification->next; - __ps_free_notification(notification); - notification = tmp; - } - } - /*Free DataShare*/ - if (uiapplication->datashare) { - datashare_x *datashare = uiapplication->datashare; - datashare_x *tmp = NULL; - while(datashare != NULL) { - tmp = datashare->next; - __ps_free_datashare(datashare); - datashare = tmp; - } - } - /*Free AppSvc*/ - if (uiapplication->appsvc) { - appsvc_x *appsvc = uiapplication->appsvc; - appsvc_x *tmp = NULL; - while(appsvc != NULL) { - tmp = appsvc->next; - __ps_free_appsvc(appsvc); - appsvc = tmp; - } - } - /*Free Category*/ - if (uiapplication->category) { - category_x *category = uiapplication->category; - category_x *tmp = NULL; - while(category != NULL) { - tmp = category->next; - __ps_free_category(category); - category = tmp; - } - } - /*Free Metadata*/ - if (uiapplication->metadata) { - metadata_x *metadata = uiapplication->metadata; - metadata_x *tmp = NULL; - while(metadata != NULL) { - tmp = metadata->next; - __ps_free_metadata(metadata); - metadata = tmp; - } - } - /*Free permission*/ - if (uiapplication->permission) { - permission_x *permission = uiapplication->permission; - permission_x *tmp = NULL; - while(permission != NULL) { - tmp = permission->next; - __ps_free_permission(permission); - permission = tmp; - } - } - /*Free DataControl*/ - if (uiapplication->datacontrol) { - datacontrol_x *datacontrol = uiapplication->datacontrol; - datacontrol_x *tmp = NULL; - while(datacontrol != NULL) { - tmp = datacontrol->next; - __ps_free_datacontrol(datacontrol); - datacontrol = tmp; - } - } - /* _PRODUCT_LAUNCHING_ENHANCED_ START */ - if (uiapplication->indicatordisplay) { - free((void *)uiapplication->indicatordisplay); - uiapplication->indicatordisplay = NULL; - } - if (uiapplication->portraitimg) { - free((void *)uiapplication->portraitimg); - uiapplication->portraitimg = NULL; - } - if (uiapplication->landscapeimg) { - free((void *)uiapplication->landscapeimg); - uiapplication->landscapeimg = NULL; - } - /* _PRODUCT_LAUNCHING_ENHANCED_ END */ - if (uiapplication->guestmode_visibility) { - free((void *)uiapplication->guestmode_visibility); - uiapplication->guestmode_visibility = NULL; - } - if (uiapplication->app_component) { - free((void *)uiapplication->app_component); - uiapplication->app_component = NULL; - } - if (uiapplication->permission_type) { - free((void *)uiapplication->permission_type); - uiapplication->permission_type = NULL; - } - if (uiapplication->component_type) { - free((void *)uiapplication->component_type); - uiapplication->component_type = NULL; - } - if (uiapplication->preload) { - free((void *)uiapplication->preload); - uiapplication->preload = NULL; - } - if (uiapplication->submode) { - free((void *)uiapplication->submode); - uiapplication->submode = NULL; - } - if (uiapplication->submode_mainid) { - free((void *)uiapplication->submode_mainid); - uiapplication->submode_mainid = NULL; - } - if (uiapplication->ui_gadget) { - free((void *)uiapplication->ui_gadget); - uiapplication->ui_gadget = NULL; - } - if (uiapplication->support_disable) { - free((void *)uiapplication->support_disable); - uiapplication->support_disable = NULL; - } - - free((void*)uiapplication); - uiapplication = NULL; + if (splashscreen->src) + free((void *)splashscreen->src); + if (splashscreen->type) + free((void *)splashscreen->type); + if (splashscreen->dpi) + free((void *)splashscreen->dpi); + if (splashscreen->orientation) + free((void *)splashscreen->orientation); + if (splashscreen->indicatordisplay) + free((void *)splashscreen->indicatordisplay); + if (splashscreen->operation) + free((void *)splashscreen->operation); + if (splashscreen->color_depth) + free((void *)splashscreen->color_depth); + free((void *)splashscreen); } -static void __ps_free_serviceapplication(serviceapplication_x *serviceapplication) +static void __ps_free_privilege(gpointer data) { - if (serviceapplication == NULL) - return; - if (serviceapplication->exec) { - free((void *)serviceapplication->exec); - serviceapplication->exec = NULL; - } - if (serviceapplication->appid) { - free((void *)serviceapplication->appid); - serviceapplication->appid = NULL; - } - if (serviceapplication->onboot) { - free((void *)serviceapplication->onboot); - serviceapplication->onboot = NULL; - } - if (serviceapplication->autorestart) { - free((void *)serviceapplication->autorestart); - serviceapplication->autorestart = NULL; - } - if (serviceapplication->type) { - free((void *)serviceapplication->type); - serviceapplication->type = NULL; - } - if (serviceapplication->enabled) { - free((void *)serviceapplication->enabled); - serviceapplication->enabled = NULL; - } - if (serviceapplication->package) { - free((void *)serviceapplication->package); - serviceapplication->package = NULL; - } - if (serviceapplication->permission_type) { - free((void *)serviceapplication->permission_type); - serviceapplication->permission_type = NULL; - } - /*Free Label*/ - if (serviceapplication->label) { - label_x *label = serviceapplication->label; - label_x *tmp = NULL; - while(label != NULL) { - tmp = label->next; - __ps_free_label(label); - label = tmp; - } - } - /*Free Icon*/ - if (serviceapplication->icon) { - icon_x *icon = serviceapplication->icon; - icon_x *tmp = NULL; - while(icon != NULL) { - tmp = icon->next; - __ps_free_icon(icon); - icon = tmp; - } - } - /*Free AppControl*/ - if (serviceapplication->appcontrol) { - appcontrol_x *appcontrol = serviceapplication->appcontrol; - appcontrol_x *tmp = NULL; - while(appcontrol != NULL) { - tmp = appcontrol->next; - __ps_free_appcontrol(appcontrol); - appcontrol = tmp; - } - } - /*Free DataControl*/ - if (serviceapplication->datacontrol) { - datacontrol_x *datacontrol = serviceapplication->datacontrol; - datacontrol_x *tmp = NULL; - while(datacontrol != NULL) { - tmp = datacontrol->next; - __ps_free_datacontrol(datacontrol); - datacontrol = tmp; - } - } - /*Free LaunchConditions*/ - if (serviceapplication->launchconditions) { - launchconditions_x *launchconditions = serviceapplication->launchconditions; - launchconditions_x *tmp = NULL; - while(launchconditions != NULL) { - tmp = launchconditions->next; - __ps_free_launchconditions(launchconditions); - launchconditions = tmp; - } - } - /*Free Notification*/ - if (serviceapplication->notification) { - notification_x *notification = serviceapplication->notification; - notification_x *tmp = NULL; - while(notification != NULL) { - tmp = notification->next; - __ps_free_notification(notification); - notification = tmp; - } - } - /*Free DataShare*/ - if (serviceapplication->datashare) { - datashare_x *datashare = serviceapplication->datashare; - datashare_x *tmp = NULL; - while(datashare != NULL) { - tmp = datashare->next; - __ps_free_datashare(datashare); - datashare = tmp; - } - } - /*Free AppSvc*/ - if (serviceapplication->appsvc) { - appsvc_x *appsvc = serviceapplication->appsvc; - appsvc_x *tmp = NULL; - while(appsvc != NULL) { - tmp = appsvc->next; - __ps_free_appsvc(appsvc); - appsvc = tmp; - } - } - /*Free Category*/ - if (serviceapplication->category) { - category_x *category = serviceapplication->category; - category_x *tmp = NULL; - while(category != NULL) { - tmp = category->next; - __ps_free_category(category); - category = tmp; - } - } - /*Free Metadata*/ - if (serviceapplication->metadata) { - metadata_x *metadata = serviceapplication->metadata; - metadata_x *tmp = NULL; - while(metadata != NULL) { - tmp = metadata->next; - __ps_free_metadata(metadata); - metadata = tmp; - } - } - /*Free permission*/ - if (serviceapplication->permission) { - permission_x *permission = serviceapplication->permission; - permission_x *tmp = NULL; - while(permission != NULL) { - tmp = permission->next; - __ps_free_permission(permission); - permission = tmp; - } - } - free((void*)serviceapplication); - serviceapplication = NULL; -} - -static void __ps_free_font(font_x *font) -{ - if (font == NULL) - return; - if (font->name) { - free((void *)font->name); - font->name = NULL; - } - if (font->text) { - free((void *)font->text); - font->text = NULL; - } - free((void*)font); - font = NULL; -} - -static void __ps_free_theme(theme_x *theme) -{ - if (theme == NULL) - return; - if (theme->name) { - free((void *)theme->name); - theme->name = NULL; - } - if (theme->text) { - free((void *)theme->text); - theme->text = NULL; - } - free((void*)theme); - theme = NULL; -} - -static void __ps_free_daemon(daemon_x *daemon) -{ - if (daemon == NULL) + privilege_x *privilege = (privilege_x *)data; + if (privilege == NULL) return; - if (daemon->name) { - free((void *)daemon->name); - daemon->name = NULL; - } - if (daemon->text) { - free((void *)daemon->text); - daemon->text = NULL; - } - free((void*)daemon); - daemon = NULL; + if (privilege->type) + free((void *)privilege->type); + if (privilege->value) + free((void *)privilege->value); + free((void *)privilege); } -static void __ps_free_ime(ime_x *ime) +static void __ps_free_datacontrol(gpointer data) { - if (ime == NULL) + datacontrol_x *datacontrol = (datacontrol_x *)data; + if (datacontrol == NULL) return; - if (ime->name) { - free((void *)ime->name); - ime->name = NULL; - } - if (ime->text) { - free((void *)ime->text); - ime->text = NULL; - } - free((void*)ime); - ime = NULL; + if (datacontrol->providerid) + free((void *)datacontrol->providerid); + if (datacontrol->access) + free((void *)datacontrol->access); + if (datacontrol->type) + free((void *)datacontrol->type); + if (datacontrol->trusted) + free((void *)datacontrol->trusted); + if (datacontrol->privileges) + g_list_free_full(datacontrol->privileges, __ps_free_privilege); + free((void *)datacontrol); } -API void pkgmgrinfo_basic_free_application(application_x *application) +static void __ps_free_application(gpointer data) { + application_x *application = (application_x *)data; if (application == NULL) return; @@ -989,8 +261,10 @@ API void pkgmgrinfo_basic_free_application(application_x *application) free((void *)application->autorestart); if (application->taskmanage) free((void *)application->taskmanage); - if (application->enabled) - free((void *)application->enabled); + if (application->categories) + free((void *)application->categories); + if (application->extraid) + free((void *)application->extraid); if (application->hwacceleration) free((void *)application->hwacceleration); if (application->screenreader) @@ -1017,6 +291,10 @@ API void pkgmgrinfo_basic_free_application(application_x *application) free((void *)application->submode); if (application->submode_mainid) free((void *)application->submode_mainid); + if (application->process_pool) + free((void *)application->process_pool); + if (application->installed_storage) + free((void *)application->installed_storage); if (application->launch_mode) free((void *)application->launch_mode); if (application->ui_gadget) @@ -1027,369 +305,155 @@ API void pkgmgrinfo_basic_free_application(application_x *application) free((void *)application->package); if (application->support_disable) free((void *)application->support_disable); + if (application->tep_name) + free((void *)application->tep_name); + if (application->zip_mount_file) + free((void *)application->zip_mount_file); + if (application->root_path) + free((void *)application->root_path); + if (application->api_version) + free((void *)application->api_version); + if (application->for_all_users) + free((void *)application->for_all_users); + if (application->effective_appid) + free((void *)application->effective_appid); + if (application->is_disabled) + free((void *)application->is_disabled); + if (application->splash_screen_display) + free((void *)application->splash_screen_display); + if (application->effectimage_type) + free((void *)application->effectimage_type); + if (application->package_type) + free((void *)application->package_type); + if (application->support_ambient) + free((void *)application->support_ambient); + if (application->alias_appid) + free((void *)application->alias_appid); + if (application->external_path) + free((void *)application->external_path); + if (application->package_system) + free((void *)application->package_system); + if (application->removable) + free((void *)application->removable); + if (application->package_installed_time) + free((void *)application->package_installed_time); + if (application->support_mode) + free((void *)application->support_mode); + if (application->setup_appid) + free((void *)application->setup_appid); /*Free Label*/ - if (application->label) { - label_x *label = application->label; - label_x *tmp = NULL; - while(label != NULL) { - tmp = label->next; - __ps_free_label(label); - label = tmp; - } - } + g_list_free_full(application->label, __ps_free_label); /*Free Icon*/ - if (application->icon) { - icon_x *icon = application->icon; - icon_x *tmp = NULL; - while(icon != NULL) { - tmp = icon->next; - __ps_free_icon(icon); - icon = tmp; - } - } + g_list_free_full(application->icon, __ps_free_icon); /*Free image*/ - if (application->image) { - image_x *image = application->image; - image_x *tmp = NULL; - while(image != NULL) { - tmp = image->next; - __ps_free_image(image); - image = tmp; - } - } - /*Free AppSvc*/ - if (application->appsvc) { - appsvc_x *appsvc = application->appsvc; - appsvc_x *tmp = NULL; - while(appsvc != NULL) { - tmp = appsvc->next; - __ps_free_appsvc(appsvc); - appsvc = tmp; - } - } + g_list_free_full(application->image, __ps_free_image); /*Free AppControl*/ - if (application->appcontrol) { - appcontrol_x *appcontrol = application->appcontrol; - appcontrol_x *tmp = NULL; - while(appcontrol != NULL) { - tmp = appcontrol->next; - __ps_free_appcontrol(appcontrol); - appcontrol = tmp; - } - } + g_list_free_full(application->appcontrol, __ps_free_appcontrol); /*Free Category*/ - if (application->category) { - category_x *category = application->category; - category_x *tmp = NULL; - while(category != NULL) { - tmp = category->next; - __ps_free_category(category); - category = tmp; - } - } + g_list_free_full(application->category, free); /*Free Metadata*/ - if (application->metadata) { - metadata_x *metadata = application->metadata; - metadata_x *tmp = NULL; - while(metadata != NULL) { - tmp = metadata->next; - __ps_free_metadata(metadata); - metadata = tmp; - } - } + g_list_free_full(application->metadata, __ps_free_metadata); /*Free permission*/ - if (application->permission) { - permission_x *permission = application->permission; - permission_x *tmp = NULL; - while(permission != NULL) { - tmp = permission->next; - __ps_free_permission(permission); - permission = tmp; - } - } + g_list_free_full(application->permission, __ps_free_permission); /*Free LaunchConditions*/ - if (application->launchconditions) { - launchconditions_x *launchconditions = application->launchconditions; - launchconditions_x *tmp = NULL; - while(launchconditions != NULL) { - tmp = launchconditions->next; - __ps_free_launchconditions(launchconditions); - launchconditions = tmp; - } - } + g_list_free_full(application->launchconditions, free); /*Free Notification*/ - if (application->notification) { - notification_x *notification = application->notification; - notification_x *tmp = NULL; - while(notification != NULL) { - tmp = notification->next; - __ps_free_notification(notification); - notification = tmp; - } - } + g_list_free_full(application->notification, __ps_free_notification); /*Free DataShare*/ - if (application->datashare) { - datashare_x *datashare = application->datashare; - datashare_x *tmp = NULL; - while(datashare != NULL) { - tmp = datashare->next; - __ps_free_datashare(datashare); - datashare = tmp; - } - } + g_list_free_full(application->datashare, __ps_free_datashare); /*Free DataControl*/ - if (application->datacontrol) { - datacontrol_x *datacontrol = application->datacontrol; - datacontrol_x *tmp = NULL; - while(datacontrol != NULL) { - tmp = datacontrol->next; - __ps_free_datacontrol(datacontrol); - datacontrol = tmp; - } - } + g_list_free_full(application->datacontrol, __ps_free_datacontrol); + /*Free BackgroundCategory*/ + g_list_free_full(application->background_category, free); + /*Free SplashScreen*/ + g_list_free_full(application->splashscreens, __ps_free_splashscreen); + free((void *)application); } +API void pkgmgrinfo_basic_free_application(application_x *application) +{ + __ps_free_application(application); +} + API void pkgmgrinfo_basic_free_package(package_x *package) { if (package == NULL) return; - if (package->for_all_users) { + if (package->for_all_users) free((void *)package->for_all_users); - package->for_all_users = NULL; - } - if (package->ns) { + if (package->ns) free((void *)package->ns); - package->ns = NULL; - } - if (package->package) { + if (package->package) free((void *)package->package); - package->package = NULL; - } - if (package->version) { + if (package->version) free((void *)package->version); - package->version = NULL; - } - if (package->installlocation) { + if (package->installlocation) free((void *)package->installlocation); - package->installlocation = NULL; - } - if (package->preload) { + if (package->preload) free((void *)package->preload); - package->preload = NULL; - } - if (package->readonly) { + if (package->readonly) free((void *)package->readonly); - package->readonly = NULL; - } - if (package->removable) { + if (package->removable) free((void *)package->removable); - package->removable = NULL; - } - if (package->update) { + if (package->update) free((void *)package->update); - package->update = NULL; - } - if (package->system) { + if (package->system) free((void *)package->system); - package->system = NULL; - } - if (package->type) { + if (package->type) free((void *)package->type); - package->type = NULL; - } - if (package->package_size) { + if (package->package_size) free((void *)package->package_size); - package->package_size = NULL; - } - if (package->installed_time) { + if (package->installed_time) free((void *)package->installed_time); - package->installed_time = NULL; - } - if (package->installed_storage) { + if (package->installed_storage) free((void *)package->installed_storage); - package->installed_storage = NULL; - } - if (package->storeclient_id) { + if (package->storeclient_id) free((void *)package->storeclient_id); - package->storeclient_id = NULL; - } - if (package->mainapp_id) { + if (package->mainapp_id) free((void *)package->mainapp_id); - package->mainapp_id = NULL; - } - if (package->package_url) { + if (package->package_url) free((void *)package->package_url); - package->package_url = NULL; - } - if (package->root_path) { + if (package->root_path) free((void *)package->root_path); - package->root_path = NULL; - } - if (package->csc_path) { + if (package->csc_path) free((void *)package->csc_path); - package->csc_path = NULL; - } - if (package->appsetting) { + if (package->appsetting) free((void *)package->appsetting); - package->appsetting = NULL; - } - if (package->nodisplay_setting) { + if (package->nodisplay_setting) free((void *)package->nodisplay_setting); - package->nodisplay_setting = NULL; - } - if (package->api_version) { + if (package->api_version) free((void *)package->api_version); - package->api_version = NULL; - } - if (package->support_disable) { + if (package->support_disable) free((void *)package->support_disable); - package->support_disable = NULL; - } + if (package->tep_name) + free((void *)package->tep_name); + if (package->zip_mount_file) + free((void *)package->zip_mount_file); + if (package->external_path) + free((void *)package->external_path); + if (package->support_mode) + free((void *)package->support_mode); /*Free Icon*/ - if (package->icon) { - icon_x *icon = package->icon; - icon_x *tmp = NULL; - while(icon != NULL) { - tmp = icon->next; - __ps_free_icon(icon); - icon = tmp; - } - } + g_list_free_full(package->icon, __ps_free_icon); /*Free Label*/ - if (package->label) { - label_x *label = package->label; - label_x *tmp = NULL; - while(label != NULL) { - tmp = label->next; - __ps_free_label(label); - label = tmp; - } - } + g_list_free_full(package->label, __ps_free_label); /*Free Author*/ - if (package->author) { - author_x *author = package->author; - author_x *tmp = NULL; - while(author != NULL) { - tmp = author->next; - __ps_free_author(author); - author = tmp; - } - } + g_list_free_full(package->author, __ps_free_author); /*Free Description*/ - if (package->description) { - description_x *description = package->description; - description_x *tmp = NULL; - while(description != NULL) { - tmp = description->next; - __ps_free_description(description); - description = tmp; - } - } + g_list_free_full(package->description, __ps_free_description); /*Free License*/ - if (package->license) { - license_x *license = package->license; - license_x *tmp = NULL; - while(license != NULL) { - tmp = license->next; - __ps_free_license(license); - license = tmp; - } - } + g_list_free_full(package->license, __ps_free_license); /*Free Privileges*/ - if (package->privileges) { - privileges_x *privileges = package->privileges; - privileges_x *tmp = NULL; - while(privileges != NULL) { - tmp = privileges->next; - __ps_free_privileges(privileges); - privileges = tmp; - } - } - /*Free UiApplication*/ - if (package->uiapplication) { - uiapplication_x *uiapplication = package->uiapplication; - uiapplication_x *tmp = NULL; - while(uiapplication != NULL) { - tmp = uiapplication->next; - __ps_free_uiapplication(uiapplication); - uiapplication = tmp; - } - } - /*Free ServiceApplication*/ - if (package->serviceapplication) { - serviceapplication_x *serviceapplication = package->serviceapplication; - serviceapplication_x *tmp = NULL; - while(serviceapplication != NULL) { - tmp = serviceapplication->next; - __ps_free_serviceapplication(serviceapplication); - serviceapplication = tmp; - } - } - /*Free Daemon*/ - if (package->daemon) { - daemon_x *daemon = package->daemon; - daemon_x *tmp = NULL; - while(daemon != NULL) { - tmp = daemon->next; - __ps_free_daemon(daemon); - daemon = tmp; - } - } - /*Free Theme*/ - if (package->theme) { - theme_x *theme = package->theme; - theme_x *tmp = NULL; - while(theme != NULL) { - tmp = theme->next; - __ps_free_theme(theme); - theme = tmp; - } - } - /*Free Font*/ - if (package->font) { - font_x *font = package->font; - font_x *tmp = NULL; - while(font != NULL) { - tmp = font->next; - __ps_free_font(font); - font = tmp; - } - } - /*Free Ime*/ - if (package->ime) { - ime_x *ime = package->ime; - ime_x *tmp = NULL; - while(ime != NULL) { - tmp = ime->next; - __ps_free_ime(ime); - ime = tmp; - } - } + g_list_free_full(package->privileges, __ps_free_privilege); + /*Free Application*/ + g_list_free_full(package->application, __ps_free_application); /*Free Compatibility*/ - if (package->compatibility) { - compatibility_x *compatibility = package->compatibility; - compatibility_x *tmp = NULL; - while(compatibility != NULL) { - tmp = compatibility->next; - __ps_free_compatibility(compatibility); - compatibility = tmp; - } - } - /*Free DeviceProfile*/ - if (package->deviceprofile) { - deviceprofile_x *deviceprofile = package->deviceprofile; - deviceprofile_x *tmp = NULL; - while(deviceprofile != NULL) { - tmp = deviceprofile->next; - __ps_free_deviceprofile(deviceprofile); - deviceprofile = tmp; - } - } - free((void*)package); - package = NULL; - return; + g_list_free_full(package->compatibility, __ps_free_compatibility); + /*Free Device profiles*/ + g_list_free_full(package->deviceprofile, free); + free((void *)package); }