Revision: 42150
          http://brlcad.svn.sourceforge.net/brlcad/?rev=42150&view=rev
Author:   brlcad
Date:     2011-01-12 16:56:37 +0000 (Wed, 12 Jan 2011)

Log Message:
-----------
follow suit and provide another BU_STR_EQUAL() macro for comparing two strings 
for equality.  this is similar to the STREQ recommendation by the ibm 
developerworks best practices article 
(http://www.ibm.com/developerworks/aix/library/au-hook_duttaC.html) so that 
developers can use equality as a truthfulness return value consistently.  there 
are approximately 1400 present uses of strcmp() in BRL-CAD that can use this 
macro.

Modified Paths:
--------------
    brlcad/trunk/include/bu.h

Modified: brlcad/trunk/include/bu.h
===================================================================
--- brlcad/trunk/include/bu.h   2011-01-12 16:42:35 UTC (rev 42149)
+++ brlcad/trunk/include/bu.h   2011-01-12 16:56:37 UTC (rev 42150)
@@ -5075,13 +5075,24 @@
  * bu_strcmp() is a macro that includes the current file name and line
  * number that can be used when bu debugging is enabled.
  *
- * BU_STR_EMPTY() is a macro that tests a string for emptiness, i.e. "" or
- * NULL.
  */
 BU_EXPORT BU_EXTERN(int bu_strcmpm, (const char *string1, const char *string2, 
const char *label));
 #define bu_strcmp(s)    bu_strcmpm(s, BU_FLSTR)
+
+/**
+ * BU_STR_EMPTY() is a convenience macro that tests a string for
+ * emptiness, i.e. "" or NULL.
+*/
 #define BU_STR_EMPTY(s) (bu_strcmpm(s, "", BU_FLSTR) == 0)
 
+/**
+ * BU_STR_EQUAL() is a convenience macro for testing two
+ * null-terminaed strings for equality, i.e. A == B, and is equivalent
+ * to (bu_strcmp(s1, s2) == 0) returning true if the strings match and
+ * false if they do not.
+ */
+#define BU_STR_EQUAL(s1, s2) (bu_strcmp((s1), (s2)) == 0)
+
 /** @} */
 
 /** @addtogroup bu_log */


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

Reply via email to