~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_arr_appstr.c

Removed/replaced DBUG symbols and TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "config.h"
17
 
 
18
 
#include "drizzled/internal/my_sys.h"
19
 
#include "drizzled/internal/m_string.h"
20
 
 
21
 
namespace drizzled
22
 
{
23
 
namespace internal
24
 
{
 
16
#include "mysys_priv.h"
 
17
#include <m_string.h>                           /* strcmp() */
 
18
 
25
19
 
26
20
/**
27
21
  Append str to array, or move to the end if it already exists
32
26
  @param size   Size of the array; array must be terminated by a NULL
33
27
                pointer, so can hold size - 1 elements
34
28
 
35
 
  @retval false  Success
36
 
  @retval true   Failure, array is full
 
29
  @retval FALSE  Success
 
30
  @retval TRUE   Failure, array is full
37
31
*/
38
32
 
39
 
bool array_append_string_unique(const char *str,
 
33
my_bool array_append_string_unique(const char *str,
40
34
                                   const char **array, size_t size)
41
35
{
42
36
  const char **p;
43
37
  /* end points at the terminating NULL element */
44
38
  const char **end= array + size - 1;
45
 
  assert(*end == NULL);
 
39
  DBUG_ASSERT(*end == NULL);
46
40
 
47
41
  for (p= array; *p; ++p)
48
42
  {
50
44
      break;
51
45
  }
52
46
  if (p >= end)
53
 
    return true;                               /* Array is full */
 
47
    return TRUE;                               /* Array is full */
54
48
 
55
 
  assert(*p == NULL || strcmp(*p, str) == 0);
 
49
  DBUG_ASSERT(*p == NULL || strcmp(*p, str) == 0);
56
50
 
57
51
  while (*(p + 1))
58
52
  {
60
54
    ++p;
61
55
  }
62
56
 
63
 
  assert(p < end);
 
57
  DBUG_ASSERT(p < end);
64
58
  *p= str;
65
59
 
66
 
  return false;                                 /* Success */
 
60
  return FALSE;                                 /* Success */
67
61
}
68
 
 
69
 
} /* namespace internal */
70
 
} /* namespace drizzled */