Alexi1952 <alexi1...@yandex.ru> writes: > Thanks for your comments! > >> In any case extern declarations like this should be avoided, much better to >> only have the declaration in one place in some *.h file. > > I agree. Currently, we have: > > mysql_priv.h: > > #ifndef MYSQL_CLIENT > ... > void *sql_alloc(size_t); > ... > #endif > > thr_malloc.cc: > > void *sql_alloc(size_t Size) > { > MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC); > return alloc_root(root,Size); > } > > This states that sql_alloc() *should not* be used in MYSQL_CLIENT context > (hence all these extern declarations). In my opinion, it's more correctly to > have: > > mysql_priv.h: > > void *sql_alloc(size_t); > > thr_malloc.cc: > > #ifndef MYSQL_CLIENT > void *sql_alloc(size_t Size) > { > MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC); > return alloc_root(root,Size); > } > #endif > > which states instead that sql_alloc() *can be* used in a client context > but should be supplied with *another definition*.
Yes, agree. > Question: May I do these changes in mysql_priv.h and thr_malloc.cc ? > On the one hand, it is resonable. On the other hand, I am confused a bit > with "mysql_priv.h" name intended to mean that content of this file belongs > to mysql internals (though this file is included in mysqlbinlog.cc) I think this is ok to do (I will check them again when I see the patch for review). It is true about mysql_priv.h being more internal, but then mysqlbinlog already goes deep deep into internals (the replication event stuff). - Kristian. _______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp