Revision: 65180
          http://sourceforge.net/p/brlcad/code/65180
Author:   starseeker
Date:     2015-06-04 18:35:06 +0000 (Thu, 04 Jun 2015)
Log Message:
-----------
More simplification

Modified Paths:
--------------
    brlcad/trunk/include/bu/opt.h
    brlcad/trunk/src/libbu/opt.c

Modified: brlcad/trunk/include/bu/opt.h
===================================================================
--- brlcad/trunk/include/bu/opt.h       2015-06-04 17:46:27 UTC (rev 65179)
+++ brlcad/trunk/include/bu/opt.h       2015-06-04 18:35:06 UTC (rev 65180)
@@ -49,11 +49,7 @@
  */
 typedef int (*bu_opt_arg_process_t)(struct bu_vls *, struct bu_opt_data *);
 
-/* typedefs to avoid confusion when working with bu_opt_data
- * and bu_opt_desc tables */
-typedef struct bu_ptbl bu_opt_dtbl_t;
-
-/** TODO - should this be a full struct to allow for easier iteration? */
+/** Use a typedef to add contextual awareness to the option data return type */
 typedef struct bu_ptbl bu_opt_data_t;
 
 /**

Modified: brlcad/trunk/src/libbu/opt.c
===================================================================
--- brlcad/trunk/src/libbu/opt.c        2015-06-04 17:46:27 UTC (rev 65179)
+++ brlcad/trunk/src/libbu/opt.c        2015-06-04 18:35:06 UTC (rev 65180)
@@ -193,7 +193,7 @@
 }
 
 HIDDEN const char *
-bu_opt_describe_internal_ascii(struct bu_opt_desc *ds, bu_opt_dtbl_t *tbl, 
struct bu_opt_desc_opts *settings)
+bu_opt_describe_internal_ascii(struct bu_opt_desc *ds, struct bu_opt_desc_opts 
*settings)
 {
     size_t i = 0;
     size_t j = 0;
@@ -208,7 +208,7 @@
     const char *finalized;
     struct bu_vls description = BU_VLS_INIT_ZERO;
     int *status;
-    if (((!ds || ds[0].index == -1) && !tbl) || (ds && tbl)) return NULL;
+    if (!ds || ds[0].index == -1) return NULL;
 
     if (settings) {
        offset = settings->offset;
@@ -216,12 +216,7 @@
        desc_cols = settings->description_columns;
     }
 
-    if (ds) {
-       while (ds[i].index != -1) i++;
-    } else {
-       int tbl_len = BU_PTBL_LEN(tbl) - 1;
-       i = (tbl_len < 0) ? 0 : tbl_len;
-    }
+    while (ds[i].index != -1) i++;
     if (i == 0) return NULL;
     opt_cnt = i;
     status = (int *)bu_calloc(opt_cnt, sizeof(int), "opt status");
@@ -229,7 +224,7 @@
     while (i < opt_cnt) {
        struct bu_opt_desc *curr;
        struct bu_opt_desc *d;
-       curr = (ds) ? &(ds[i]) : (struct bu_opt_desc *)BU_PTBL_GET(tbl, i) ;
+       curr = &(ds[i]);
        if (!status[i]) {
            struct bu_vls opts = BU_VLS_INIT_ZERO;
            struct bu_vls help_str = BU_VLS_INIT_ZERO;
@@ -238,7 +233,7 @@
             * pass, so set the status flags accordingly */
            j = i;
            while (j < opt_cnt) {
-               d = (ds) ? &(ds[j]) : (struct bu_opt_desc *)BU_PTBL_GET(tbl, j);
+               d = &(ds[j]);
                if (d->index == curr->index) {
                    status[j] = 1;
                }
@@ -249,7 +244,7 @@
             * the same index defining aliases, so accumulate all of them. */
            j = i;
            while (j < opt_cnt) {
-               d = (ds) ? &(ds[j]) : (struct bu_opt_desc *)BU_PTBL_GET(tbl, j);
+               d = &(ds[j]);
                if (d->index == curr->index) {
                    int new_len = strlen(d->shortopt_doc);
                    if (new_len > 0) {
@@ -270,7 +265,7 @@
            /* Now do the long opts */
            j = i;
            while (j < opt_cnt) {
-               d = (ds) ? &(ds[j]) : (struct bu_opt_desc *)BU_PTBL_GET(tbl, j);
+               d = &(ds[j]);
                if (d->index == curr->index) {
                    int new_len = strlen(d->longopt_doc);
                    if (new_len > 0) {
@@ -311,19 +306,11 @@
 bu_opt_describe(struct bu_opt_desc *ds, struct bu_opt_desc_opts *settings)
 {
     if (!ds) return NULL;
-    if (!settings) return bu_opt_describe_internal_ascii(ds, NULL, NULL);
+    if (!settings) return bu_opt_describe_internal_ascii(ds, NULL);
     return NULL;
 }
 
-const char *
-bu_opt_describe_dtbl(bu_opt_dtbl_t *dtbl, struct bu_opt_desc_opts *settings)
-{
-    if (!dtbl) return NULL;
-    if (!settings) return bu_opt_describe_internal_ascii(NULL, dtbl, NULL);
-    return NULL;
-}
 
-
 HIDDEN char *
 opt_process(char **eq_arg, const char *opt_candidate)
 {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to