From bb879dfc882455b329168fbb5684f0b277c26b82 Mon Sep 17 00:00:00 2001 From: Dennis Schafroth Date: Wed, 3 Oct 2012 16:27:08 +0200 Subject: [PATCH] Function to compare reclist_sortparm structure --- src/reclists.c | 8 ++++++++ src/reclists.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/reclists.c b/src/reclists.c index 097b8c7..07dd0fe 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -398,6 +398,14 @@ struct record_cluster *reclist_insert(struct reclist *l, return cluster; } +int reclist_sortparms_cmp(struct reclist_sortparms *sort1, struct reclist_sortparms *sort2) +{ + if (sort1 == sort2) + return 0; + if (sort1 == 0 || sort2 == 0) + return 1; + return strcmp(sort1->name, sort2->name) || sort1->increasing != sort1->increasing || sort1->type != sort2->type; +} /* * Local variables: * c-basic-offset: 4 diff --git a/src/reclists.h b/src/reclists.h index 40bcdf9..818aea5 100644 --- a/src/reclists.h +++ b/src/reclists.h @@ -50,6 +50,7 @@ struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms, int reclist_get_num_records(struct reclist *l); struct record_cluster *reclist_get_cluster(struct reclist *l, int i); +int reclist_sortparms_cmp(struct reclist_sortparms *sort1, struct reclist_sortparms *sort2); #endif -- 1.7.10.4