Tom,

Also, note that public API changes like the one below would have to follow the 
change policy described in the CHANGES file.  My gut says that it'd probably be 
a minimally impacting change, but figuring out the regex might be tricky.  If 
it were not minimally impacting, you'd want to create a new function, update 
all our code to use the new one, and mark the old API call as deprecated.

Cheers!
Sean

 
On Aug 28, 2013, at 3:56 PM, [email protected] wrote:

> Revision: 57233
>          http://sourceforge.net/p/brlcad/code/57233
> Author:   tbrowder2
> Date:     2013-08-28 19:55:58 +0000 (Wed, 28 Aug 2013)
> Log Message:
> -----------
> change func to use enum args
> 
> Modified Paths:
> --------------
>    brlcad/trunk/include/bu.h
>    brlcad/trunk/src/libbu/avs.c
> 
> Modified: brlcad/trunk/include/bu.h
> ===================================================================
> --- brlcad/trunk/include/bu.h 2013-08-28 19:41:59 UTC (rev 57232)
> +++ brlcad/trunk/include/bu.h 2013-08-28 19:55:58 UTC (rev 57233)
> @@ -1900,6 +1900,13 @@
>  * Routines to manage attribute/value sets.
>  */
> 
> +/** for attr and avs use.
> + */
> +typedef enum {
> +  BU_ATTR_CREATED,
> +  BU_ATTR_MODIFIED
> +} bu_attr_time_t;
> +
> /**
>  * These strings may or may not be individually allocated, it depends
>  * on usage.
> @@ -2675,7 +2682,7 @@
>  * Get current UTC date-time for attribute creation or modification times.
>  */
> BU_EXPORT extern void bu_avs_set_date(struct bu_attribute_value_pair *app,
> -                                   const char* typ);
> +                                   const bu_attr_time_t typ);
> 
> /**
>  * Initialize avs with storage for len entries.
> 
> Modified: brlcad/trunk/src/libbu/avs.c
> ===================================================================
> --- brlcad/trunk/src/libbu/avs.c      2013-08-28 19:41:59 UTC (rev 57232)
> +++ brlcad/trunk/src/libbu/avs.c      2013-08-28 19:55:58 UTC (rev 57233)
> @@ -29,16 +29,15 @@
> #define AVS_ALLOCATION_INCREMENT 32
> 
> void
> -bu_avs_set_date(struct bu_attribute_value_pair *app, const char* typ)
> +bu_avs_set_date(struct bu_attribute_value_pair *app, const bu_attr_time_t 
> typ)
> {
>     /* save the current time */
>     time_t curr_time = time(0);
> -    const int typ_is_created = BU_STR_EQUAL(typ, "created") ? 1 : 0;
> 
> -    if (typ_is_created)
> -        app->created = (int64_t)curr_time;
> +    if (typ == BU_ATTR_CREATED)
> +     app->created = (int64_t)curr_time;
>     else
> -        app->modified = (int64_t)curr_time;
> +     app->modified = (int64_t)curr_time;
> }
> 
> void
> @@ -115,6 +114,8 @@
>           } else {
>               app->value = (char *)NULL;
>           }
> +         /* add modification time */
> +         bu_avs_set_date(app, BU_ATTR_MODIFIED);
>           return 1;
>       }
>     }
> @@ -140,6 +141,8 @@
>     } else {
>       app->value = (char *)NULL;
>     }
> +    /* add creation time */
> +    bu_avs_set_date(app, BU_ATTR_CREATED);
>     return 2;
> }
> 
> @@ -316,6 +319,8 @@
>     } else {
>       app->value = (char *)NULL;
>     }
> +    /* add creation time */
> +    bu_avs_set_date(app, BU_ATTR_CREATED);
> }
> 
> /*
> 
> This was sent by the SourceForge.net collaborative development platform, the 
> world's largest Open Source development site.
> 
> 
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
> Discover the easy way to master current and previous Microsoft technologies
> and advance your career. Get an incredible 1,500+ hours of step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> _______________________________________________
> BRL-CAD Source Commits mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/brlcad-commits


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to