~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/list.c

  • Committer: Mats Kindahl
  • Date: 2008-08-25 11:54:47 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 372.
  • Revision ID: mats@mysql.com-20080825115447-tg73zkyjnldm7p4c
Hiding THD::proc_info field and providing a setter and getter.
Replacing use of swap_variables() in C++ code with std::swap().
Moving swap_variables() into C files where it is used.
Replacing some function-like macros with inline functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
LIST *list_add(LIST *root, LIST *element)
28
28
{
29
 
  DBUG_ENTER("list_add");
30
 
  DBUG_PRINT("enter",("root: 0x%lx  element: 0x%lx", (long) root, (long) element));
31
29
  if (root)
32
30
  {
33
31
    if (root->prev)                     /* If add in mid of list */
38
36
  else
39
37
    element->prev=0;
40
38
  element->next=root;
41
 
  DBUG_RETURN(element);                 /* New root */
 
39
  return(element);                      /* New root */
42
40
}
43
41
 
44
42
 
70
68
 
71
69
LIST *list_cons(void *data, LIST *list)
72
70
{
73
 
  LIST *new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
 
71
  LIST * const new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
74
72
  if (!new_charset)
75
 
    return 0;
 
73
    return NULL;
76
74
  new_charset->data=data;
77
75
  return list_add(list,new_charset);
78
76
}
93
91
  return last;
94
92
}
95
93
 
96
 
uint list_length(LIST *list)
97
 
{
98
 
  uint count;
99
 
  for (count=0 ; list ; list=list->next, count++) ;
100
 
  return count;
101
 
}
102
 
 
103
 
 
104
94
int list_walk(LIST *list, list_walk_action action, uchar* argument)
105
95
{
106
 
  int error=0;
107
96
  while (list)
108
97
  {
 
98
    int error;
109
99
    if ((error = (*action)(list->data,argument)))
110
100
      return error;
111
101
    list=list_rest(list);