Moved and documented compare_string().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4187 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2003-08-02 00:01:57 +00:00
parent 572b5b77d3
commit a2a6c4bdd7
+25 -14
View File
@@ -54,6 +54,31 @@ public:
bool fArray;
};
// compare_string
/*! \brief \c NULL aware strcmp().
\c NULL is considered the least of all strings. \c NULL equals \c NULL.
\param str1 First string.
\param str2 Second string.
\return A value less than 0, if \a str1 is less than \a str2,
0, if they are equal, or a value greater than 0, if
\a str1 is greater \a str2.
*/
static inline
int
compare_string(const char *str1, const char *str2)
{
if (str1 == NULL) {
if (str2 == NULL)
return 0;
return 1;
} else if (str2 == NULL)
return -1;
return strcmp(str1, str2);
}
// constructor
BPartition::BPartition()
: fDevice(NULL),
@@ -977,20 +1002,6 @@ BPartition::_RemoveObsoleteDescendants(user_partition_data *data,
return B_OK;
}
// compare_string
static
int
compare_string(const char *str1, const char *str2)
{
if (str1 == NULL) {
if (str2 == NULL)
return 0;
return 1;
} else if (str2 == NULL)
return -1;
return strcmp(str1, str2);
}
// _Update
status_t
BPartition::_Update(user_partition_data *data, bool *updated)