Bug #5446 list functions in my_list.h do not have namespace prefix
Submitted: 7 Sep 2004 9:20 Modified: 3 Oct 2008 8:58
Reporter: Ilja Booij Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S4 (Feature request)
Version:4.1.0-alpha, 6.0-bzr OS:Any
Assigned to: CPU Architecture:Any
Triage: Triaged: D5 (Feature request)

[7 Sep 2004 9:20] Ilja Booij
Description:
The functions in my_list.h (/usr/include/mysql/my_list.h on my system) do not have a prefix of my_ or mysql_. This causes name clashes when compiling an application with libmysql which uses the same function names. 

From my_list.h:
  struct st_list *prev,*next;
  void *data;
} LIST;

typedef int (*list_walk_action)(void *,void *);

extern LIST *list_add(LIST *root,LIST *element);
extern LIST *list_delete(LIST *root,LIST *element);
extern LIST *list_cons(void *data,LIST *root);
extern LIST *list_reverse(LIST *root);
extern void list_free(LIST *root,pbool free_data);
extern uint list_length(LIST *list);
extern int list_walk(LIST *list,list_walk_action action,gptr argument);

#define rest(a) ((a)->next)
#define list_push(a,b) (a)=list_cons((b),(a))
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }

How to repeat:
try to compile a program with libmysql-4.1.0-alpha (of course #include <mysql/mysql.h>), that itself has a function from the list above (e.g. list_add)

Suggested fix:
Add a prefix (my_ or mysql_)  to the functions and macros.
[3 Oct 2008 8:58] Valeriy Kravchuk
Thank you for a reasonable feature request.