pnoltes commented on code in PR #476:
URL: https://github.com/apache/celix/pull/476#discussion_r1155948967


##########
bundles/shell/shell/src/lb_command.c:
##########
@@ -49,16 +46,68 @@ typedef struct lb_options {
     char *listGroup;
 } lb_options_t;
 
-static char * psCommand_stateString(bundle_state_e state);
+typedef struct lb_command_bundle_info {
+    long id;
+    char* name;
+    char* symbolicName;
+    celix_version_t* version;
+    char* group;
+    char* location;
+    bundle_state_e state;
+} lb_command_bundle_info_t;
+
+static int lbCommand_bundleInfoCmp(const lb_command_bundle_info_t* a, const 
lb_command_bundle_info_t* b) {
+    return (int)(a->id - b->id);
+}
+
+static void lbCommand_collectBundleInfo_callback(void* data, const 
celix_bundle_t* bnd) {
+    celix_array_list_t* infoEntries = data;
+    lb_command_bundle_info_t* info = malloc(sizeof(*info));
+    if (info != NULL) {
+        info->id = celix_bundle_getId(bnd);
+        info->name = celix_utils_strdup(celix_bundle_getName(bnd));
+        info->location = celix_utils_strdup(celix_bundle_getLocation(bnd));

Review Comment:
   Good point. Note that the framework will only do a bundle_revise if the 
bundle is stopped (and thus not useable in the celix_bundleContext_useBundles), 
but it will do a bundle_revise while the bundle is installed. 
   This means that when tracking bundles (celix_bundleContext_trackBundles) 
this can be an issue.
   
   I will add a celix_bundleArchive_getLocation function that always returns a 
copy of location, to prevent this issue. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to