static void init_available_charsets_IB(char* fname) { myf myflags = MYF(0); if (!charset_initialized) { CHARSET_INFO **cs; bzero(&all_charsets,sizeof(all_charsets)); init_compiled_charsets(myflags); /* Copy compiled charsets */ for (cs=all_charsets; cs < all_charsets+array_elements(all_charsets)-1 ; cs++) { if (*cs) { if (cs[0]->ctype) if (init_state_maps(*cs)) *cs= NULL; } } my_read_charset_file(fname,myflags); charset_initialized=1; } }
static CHARSET_INFO *get_internal_charset_IB(char* charstes_dir, uint cs_number, myf flags) { char buf[FN_REFLEN] = {0}; CHARSET_INFO *cs; strcpy(buf, charstes_dir); if ((cs= all_charsets[cs_number])) { if (cs->state & MY_CS_READY) /* if CS is already initialized */ return cs; if (!(cs->state & (MY_CS_COMPILED|MY_CS_LOADED))) /* if CS is not in memory */ { strcat(buf, cs->csname); strcat(buf, ".xml"); my_read_charset_file(buf, flags); } if (cs->state & MY_CS_AVAILABLE) { if (!(cs->state & MY_CS_READY)) { if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) || (cs->coll->init && cs->coll->init(cs, cs_alloc))) cs= NULL; else cs->state|= MY_CS_READY; } } else cs= NULL; } return cs; }
static void init_available_charsets(void) { char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; CHARSET_INFO **cs; MY_CHARSET_LOADER loader; memset(&all_charsets, 0, sizeof(all_charsets)); init_compiled_charsets(MYF(0)); /* Copy compiled charsets */ for (cs=all_charsets; cs < all_charsets+array_elements(all_charsets)-1 ; cs++) { if (*cs) { if (cs[0]->ctype) if (init_state_maps(*cs)) *cs= NULL; } } my_charset_loader_init_mysys(&loader); my_stpcpy(get_charsets_dir(fname), MY_CHARSET_INDEX); my_read_charset_file(&loader, fname, MYF(0)); }
static void init_available_charsets(void) { char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; MY_CHARSET_LOADER loader; memset(&all_charsets, 0, sizeof(all_charsets)); init_compiled_charsets(MYF(0)); /* Copy compiled charsets */ my_charset_loader_init_mysys(&loader); my_stpcpy(get_charsets_dir(fname), MY_CHARSET_INDEX); my_read_charset_file(&loader, fname, MYF(0)); }
static CHARSET_INFO * get_internal_charset(MY_CHARSET_LOADER *loader, uint cs_number, myf flags) { char buf[FN_REFLEN]; CHARSET_INFO *cs; DBUG_ASSERT(cs_number < array_elements(all_charsets)); if ((cs= all_charsets[cs_number])) { if (cs->state & MY_CS_READY) /* if CS is already initialized */ return cs; /* To make things thread safe we are not allowing other threads to interfere while we may changing the cs_info_table */ mysql_mutex_lock(&THR_LOCK_charset); if (!(cs->state & (MY_CS_COMPILED|MY_CS_LOADED))) /* if CS is not in memory */ { MY_CHARSET_LOADER loader; strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS); my_charset_loader_init_mysys(&loader); my_read_charset_file(&loader, buf, flags); } if (cs->state & MY_CS_AVAILABLE) { if (!(cs->state & MY_CS_READY)) { if ((cs->cset->init && cs->cset->init(cs, loader)) || (cs->coll->init && cs->coll->init(cs, loader))) { cs= NULL; } else cs->state|= MY_CS_READY; } } else cs= NULL; mysql_mutex_unlock(&THR_LOCK_charset); } return cs; }
static my_bool init_available_charsets(myf myflags) #endif { char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; my_bool error=FALSE; /* We have to use charset_initialized to not lock on THR_LOCK_charset inside get_internal_charset... */ if (!charset_initialized) { CHARSET_INFO **cs; /* To make things thread safe we are not allowing other threads to interfere while we may changing the cs_info_table */ pthread_mutex_lock(&THR_LOCK_charset); if (!charset_initialized) { bzero(&all_charsets,sizeof(all_charsets)); init_compiled_charsets(myflags); /* Copy compiled charsets */ for (cs=all_charsets; cs < all_charsets+array_elements(all_charsets)-1 ; cs++) { if (*cs) { if (cs[0]->ctype) if (init_state_maps(*cs)) *cs= NULL; } } strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); error= my_read_charset_file(fname,myflags); charset_initialized=1; } pthread_mutex_unlock(&THR_LOCK_charset); } return error; }
static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) { char buf[FN_REFLEN]; CHARSET_INFO *cs; if ((cs= all_charsets[cs_number])) { if (cs->state & MY_CS_READY) /* if CS is already initialized */ return cs; /* To make things thread safe we are not allowing other threads to interfere while we may changing the cs_info_table */ pthread_mutex_lock(&THR_LOCK_charset); if (!(cs->state & (MY_CS_COMPILED|MY_CS_LOADED))) /* if CS is not in memory */ { strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS); my_read_charset_file(buf,flags); } if (cs->state & MY_CS_AVAILABLE) { if (!(cs->state & MY_CS_READY)) { if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) || (cs->coll->init && cs->coll->init(cs, cs_alloc))) cs= NULL; else cs->state|= MY_CS_READY; } } else cs= NULL; pthread_mutex_unlock(&THR_LOCK_charset); } return cs; }
static void init_available_charsets(void) { char fname[FN_REFLEN + sizeof(MY_CHARSET_INDEX)]; CHARSET_INFO **cs; bzero(&all_charsets,sizeof(all_charsets)); init_compiled_charsets(MYF(0)); /* Copy compiled charsets */ for (cs=all_charsets; cs < all_charsets+array_elements(all_charsets)-1 ; cs++) { if (*cs) { if (cs[0]->ctype) if (init_state_maps(*cs)) *cs= NULL; } } strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); my_read_charset_file(fname, MYF(0)); }