From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Sort sections and architectures in the pages table.
Date: Fri, 29 Jul 2016 10:30:03 -0500 (EST) [thread overview]
Message-ID: <15148708720367194796.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
Sort sections and architectures in the pages table.
Modified Files:
--------------
mdocml:
dba.c
Revision Data
-------------
Index: dba.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/dba.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Ldba.c -Ldba.c -u -p -r1.2 -r1.3
--- dba.c
+++ dba.c
@@ -33,6 +33,7 @@
static void *prepend(const char *, char);
static void dba_pages_write(struct dba_array *);
static int compare_names(const void *, const void *);
+static int compare_strings(const void *, const void *);
static void dba_macros_write(struct dba_array *);
static void dba_macro_write(struct dba_array *);
@@ -243,24 +244,26 @@ prepend(const char *instr, char inbyte)
static void
dba_pages_write(struct dba_array *pages)
{
- struct dba_array *page, *names;
- void *entry;
+ struct dba_array *page, *entry;
int32_t pos_pages, pos_end;
pos_pages = dba_array_writelen(pages, 5);
dba_array_FOREACH(pages, page) {
dba_array_setpos(page, DBP_NAME, dba_tell());
- names = dba_array_get(page, DBP_NAME);
- dba_array_sort(names, compare_names);
- dba_array_writelst(names);
+ entry = dba_array_get(page, DBP_NAME);
+ dba_array_sort(entry, compare_names);
+ dba_array_writelst(entry);
}
dba_array_FOREACH(pages, page) {
dba_array_setpos(page, DBP_SECT, dba_tell());
- dba_array_writelst(dba_array_get(page, DBP_SECT));
+ entry = dba_array_get(page, DBP_SECT);
+ dba_array_sort(entry, compare_strings);
+ dba_array_writelst(entry);
}
dba_array_FOREACH(pages, page) {
if ((entry = dba_array_get(page, DBP_ARCH)) != NULL) {
dba_array_setpos(page, DBP_ARCH, dba_tell());
+ dba_array_sort(entry, compare_strings);
dba_array_writelst(entry);
} else
dba_array_setpos(page, DBP_ARCH, 0);
@@ -292,6 +295,15 @@ compare_names(const void *vp1, const voi
strcasecmp(cp1 + 1, cp2 + 1);
}
+static int
+compare_strings(const void *vp1, const void *vp2)
+{
+ const char *cp1, *cp2;
+
+ cp1 = *(char **)vp1;
+ cp2 = *(char **)vp2;
+ return strcmp(cp1, cp2);
+}
/*** functions for handling macros ************************************/
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2016-07-29 15:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15148708720367194796.enqueue@fantadrom.bsd.lv \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).