Revision: 42283
http://brlcad.svn.sourceforge.net/brlcad/?rev=42283&view=rev
Author: tbrowder2
Date: 2011-01-14 23:46:26 +0000 (Fri, 14 Jan 2011)
Log Message:
-----------
sort attribute-value set array by attribute name
Modified Paths:
--------------
brlcad/trunk/src/libged/attr.c
Modified: brlcad/trunk/src/libged/attr.c
===================================================================
--- brlcad/trunk/src/libged/attr.c 2011-01-14 22:10:35 UTC (rev 42282)
+++ brlcad/trunk/src/libged/attr.c 2011-01-14 23:46:26 UTC (rev 42283)
@@ -27,6 +27,14 @@
#include "ged.h"
+/* comparison function for the avs->name qsort below -- based on example in
libc: man qsort */
+static int
+cmpstringp(const void *p1, const void *p2)
+{
+ return strcmp((char * const)((struct bu_attribute_value_pair *)p1)->name,
+ (char * const)((struct bu_attribute_value_pair *)p2)->name);
+}
+
int
ged_attr(struct ged *gedp, int argc, const char *argv[])
{
@@ -72,6 +80,9 @@
return GED_ERROR;
}
+ /* sort attribute-value set array by attribute name */
+ qsort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair),
cmpstringp);
+
if (BU_STR_EQUAL(argv[1], "get")) {
if (argc == 3) {
/* just list all the attributes */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits