This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Consolidate link map sorting


On 11/09/2017 10:45 AM, Andreas Schwab wrote:
+/* Sort array MAPS according to dependencies of the contained objects.
+   Array USED, if non-NULL, is permutated along MAPS.  If USE_RELDEPS also
+   take relocation dependencies into account.  */
+void
+_dl_sort_maps (struct link_map **maps, unsigned int nmaps, char *used,
+	       bool use_reldeps)
+{
+  /* A list of one element need not be sorted.  */
+  if (nmaps <= 1)
+    return;

We bail out early if we skipped the initial element of the link map array. Previously, we would have sorted the one-element list, which is a no-op as well (the “while (k > i)” loop isn't entered), so this should be fine.

I didn't find any other differences after comparing the implementations line by line, so this is okay. This is a great cleanup.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]