Index: menuselect_newt.c =================================================================== --- menuselect_newt.c (revision 905) +++ menuselect_newt.c (working copy) @@ -91,8 +91,8 @@ char buffer[128] = { 0 }; struct depend *dep; - struct conflict *con; - struct use *uses; + struct depend *con; + struct depend *uses; reset_display(); @@ -119,6 +119,7 @@ strcpy(buffer, ""); AST_LIST_TRAVERSE(&mem->uses, uses, list) { strncat(buffer, uses->displayname, sizeof(buffer) - strlen(buffer) - 1); + strncat(buffer, uses->member ? "(M)" : "(E)", sizeof(buffer) - strlen(buffer) - 1); if (AST_LIST_NEXT(uses, list)) strncat(buffer, ", ", sizeof(buffer) - strlen(buffer) - 1); } Index: menuselect.c =================================================================== --- menuselect.c (revision 905) +++ menuselect.c (working copy) @@ -192,8 +192,8 @@ static void free_member(struct member *mem) { struct depend *dep; - struct conflict *cnf; - struct use *use; + struct depend *cnf; + struct depend *use; while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list))) free(dep); @@ -211,8 +211,8 @@ struct tree *tree; struct member *mem; struct depend *dep; - struct conflict *cnf; - struct use *use; + struct depend *cnf; + struct depend *use; mxml_node_t *cur; mxml_node_t *cur2; mxml_node_t *cur3; @@ -345,51 +345,24 @@ cur3 && cur3->child; cur3 = mxmlFindElement(cur3, cur2, "use", NULL, NULL, MXML_NO_DESCEND)) { -#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref) - const char *usetype; - if ((usetype = mxmlElementGetAttr(cur3, "type")) && !strcasecmp(usetype, "module")) { - /* If the compiler won't support the functionality required for "use", then "use" -> "depend" */ - if (!(dep = calloc(1, sizeof(*dep)))) { - free_member(mem); - return -1; + if (!(use = calloc(1, sizeof(*use)))) { + free_member(mem); + return -1; + } + if ((tmp = mxmlElementGetAttr(cur3, "name"))) { + if (!strlen_zero(tmp)) { + use->name = tmp; } - if ((tmp = mxmlElementGetAttr(cur3, "name"))) { - if (!strlen_zero(tmp)) { - dep->name = tmp; - } + } + if (!strlen_zero(cur3->child->value.opaque)) { + use->displayname = cur3->child->value.opaque; + if (!use->name) { + use->name = use->displayname; } - if (!strlen_zero(cur3->child->value.opaque)) { - dep->displayname = cur3->child->value.opaque; - if (!dep->name) { - dep->name = dep->displayname; - } - AST_LIST_INSERT_TAIL(&mem->deps, dep, list); - } else { - free(dep); - } - } else { /* use type != module */ -#endif - if (!(use = calloc(1, sizeof(*use)))) { - free_member(mem); - return -1; - } - if ((tmp = mxmlElementGetAttr(cur3, "name"))) { - if (!strlen_zero(tmp)) { - use->name = tmp; - } - } - if (!strlen_zero(cur3->child->value.opaque)) { - use->displayname = cur3->child->value.opaque; - if (!use->name) { - use->name = use->displayname; - } - AST_LIST_INSERT_TAIL(&mem->uses, use, list); - } else { - free(use); - } -#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref) + AST_LIST_INSERT_TAIL(&mem->uses, use, list); + } else { + free(use); } -#endif } if (add_member(mem, cat)) @@ -497,7 +470,7 @@ unsigned int result = 0; struct category *cat; struct member *mem; - struct conflict *cnf; + struct depend *cnf; struct dep_file *dep_file; unsigned int changed, old_failure; @@ -668,9 +641,10 @@ struct category *cat, *cat2; struct member *mem, *mem2; struct depend *dep; - struct conflict *cnf; - struct use *use; + struct depend *cnf; + struct depend *use; + /* Traverse through each module's dependency list and determine whether each is another module */ AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { AST_LIST_TRAVERSE(&mem->deps, dep, list) { @@ -699,6 +673,7 @@ } } + /* Traverse through each module's use list and determine whether each is another module */ AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { AST_LIST_TRAVERSE(&mem->uses, use, list) { @@ -727,7 +702,23 @@ } } + /* If weak linking is not supported, move module uses which are other modules to the dependency list */ +#if !defined(HAVE_ATTRIBUTE_weak_import) && !defined(HAVE_ATTRIBUTE_weakref) AST_LIST_TRAVERSE(&categories, cat, list) { + AST_LIST_TRAVERSE(&cat->members, mem, list) { + AST_LIST_TRAVERSE_SAFE_BEGIN(&mem->uses, use, list) { + if (use->member) { + AST_LIST_REMOVE_CURRENT(&mem->uses, list); + AST_LIST_INSERT_TAIL(&mem->deps, use, list); + } + } + AST_LIST_TRAVERSE_SAFE_END; + } + } +#endif + + /* Traverse through each category marked as exclusive and mark every member as conflicting with every other member */ + AST_LIST_TRAVERSE(&categories, cat, list) { if (!cat->exclusive) continue; @@ -746,6 +737,7 @@ } } + /* Traverse through each category and determine whether named conflicts for each module are other modules */ AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { @@ -1069,7 +1061,7 @@ struct category *cat; struct member *mem; struct depend *dep; - struct use *use; + struct depend *use; struct dep_file *dep_file; if (!(f = fopen(output_makedeps, "w"))) { @@ -1155,7 +1147,7 @@ struct category *cat; struct member *mem; struct depend *dep; - struct use *use; + struct depend *use; if (!(f = fopen(output_makeopts, "w"))) { fprintf(stderr, "Unable to open build configuration file (%s) for writing!\n", output_makeopts); @@ -1291,7 +1283,7 @@ struct category *cat; struct member *mem; struct depend *dep; - struct conflict *cnf; + struct depend *cnf; AST_LIST_TRAVERSE(&categories, cat, list) { fprintf(stderr, "Category: '%s'\n", cat->name); @@ -1319,8 +1311,8 @@ struct category *cat; struct member *mem; struct depend *dep; - struct conflict *cnf; - struct use *use; + struct depend *cnf; + struct depend *use; while ((cat = AST_LIST_REMOVE_HEAD(&categories, list))) { while ((mem = AST_LIST_REMOVE_HEAD(&cat->members, list))) { @@ -1411,7 +1403,7 @@ struct category *cat; struct member *mem; struct depend *dep; - struct use *use; + struct depend *use; struct dep_file *dep_file; unsigned int dep_header_printed; unsigned int group_header_printed; Index: menuselect_gtk.c =================================================================== --- menuselect_gtk.c (revision 905) +++ menuselect_gtk.c (working copy) @@ -269,8 +269,8 @@ char use_buf[64] = ""; char cnf_buf[64] = ""; struct depend *dep; - struct use *use; - struct conflict *cnf; + struct depend *use; + struct depend *cnf; AST_LIST_TRAVERSE(&mem->deps, dep, list) { strncat(dep_buf, dep->displayname, sizeof(dep_buf) - strlen(dep_buf) - 1); Index: menuselect.h =================================================================== --- menuselect.h (revision 905) +++ menuselect.h (working copy) @@ -41,34 +41,12 @@ const char *displayname; /*! if this dependency is a member, not an external object */ struct member *member; + /*! if this package was found */ + unsigned char met:1; /*! for linking */ AST_LIST_ENTRY(depend) list; }; -struct conflict { - /*! the name of the conflict */ - const char *name; - /*! the display name of the conflict */ - const char *displayname; - /*! if this conflict is a member, not an external object */ - const struct member *member; - /*! for linking */ - AST_LIST_ENTRY(conflict) list; -}; - -struct use { - /*! the name of the used package */ - const char *name; - /*! the display name of the used package */ - const char *displayname; - /*! if this used package is a member, not an external object */ - struct member *member; - /*! if this used package was found */ - unsigned char met; - /*! for linking */ - AST_LIST_ENTRY(use) list; -}; - enum failure_types { NO_FAILURE = 0, SOFT_FAILURE = 1, @@ -106,9 +84,9 @@ /*! dependencies of this module */ AST_LIST_HEAD_NOLOCK(, depend) deps; /*! conflicts of this module */ - AST_LIST_HEAD_NOLOCK(, conflict) conflicts; + AST_LIST_HEAD_NOLOCK(, depend) conflicts; /*! optional packages used by this module */ - AST_LIST_HEAD_NOLOCK(, use) uses; + AST_LIST_HEAD_NOLOCK(, depend) uses; /*! for making a list of modules */ AST_LIST_ENTRY(member) list; }; Index: menuselect_curses.c =================================================================== --- menuselect_curses.c (revision 905) +++ menuselect_curses.c (working copy) @@ -183,8 +183,8 @@ { char buf[64]; struct depend *dep; - struct conflict *con; - struct use *use; + struct depend *con; + struct depend *use; wmove(menu, end - start + 2, max_x / 2 - 16); wclrtoeol(menu); Index: linkedlists.h =================================================================== --- linkedlists.h (revision 905) +++ linkedlists.h (working copy) @@ -222,14 +222,16 @@ the list traversal (and without having to re-traverse the list to modify the previous entry, if any). */ -#define AST_LIST_REMOVE_CURRENT(head, field) \ +#define AST_LIST_REMOVE_CURRENT(head, field) do { \ + __new_prev->field.next = NULL; \ __new_prev = __list_prev; \ if (__list_prev) \ __list_prev->field.next = __list_next; \ else \ (head)->first = __list_next; \ if (!__list_next) \ - (head)->last = __list_prev; + (head)->last = __list_prev; \ + } while (0) /*! \brief Inserts a list entry before the current entry during a traversal.