hash_delete (cs->symb_to_repr, cd->symbol, NULL, NULL); hash_insert (cs->symb_to_repr, cd->symbol, cd, 0);
static int load_charset (const char *filename, CHARSET ** csp, short multbyte){  CHARDESC *cd = NULL;  CHARSET *cs = NULL;  CHARMAP *m = NULL;  FILE *fp;  char buffer[1024];  int i;  int rv = -1;  cs = *csp = charset_new (multbyte ? 1031 : 257);  dprint (2, (debugfile, "load_charset: Trying to open: %s\n", filename));    if ((fp = fopen (filename, "r")) == NULL)  {    char _filename[_POSIX_PATH_MAX];    snprintf (_filename, sizeof (_filename), "%s/%s", CHARMAPS_DIR, filename);    dprint (2, (debugfile, "load_charset: Trying to open: %s\n", _filename));        if ((fp = fopen (_filename, "r")) == NULL)    {      dprint (2, (debugfile, "load_charset: Failed.\n"));      goto bail;    }  }        if ((m = parse_charmap_header (fp)) == NULL)    goto bail;  /* Don't handle multibyte character sets unless explicitly requested   * to do so.   */  if (m->multbyte > 1 && !multbyte)  {    dprint (2, (debugfile, "load_charset: m->multbyte == %d\n",		(int) m->multbyte));    goto bail;  }  cs->multbyte = m->multbyte;  while (fgets (buffer, sizeof (buffer), fp) != NULL)  {    i = parse_charmap_line (buffer, m, &cd);    if (i == CL_END)      break;    else if (i == CL_DESCR)    {      dprint (5, (debugfile, "load_charset: Got character description: < %s > -> %x\n",		  cd->symbol, cd->repr));      hash_delete (cs->symb_to_repr, cd->symbol, NULL, NULL);      hash_insert (cs->symb_to_repr, cd->symbol, cd, 0);      if (!multbyte)      {	if (0 <= cd->repr && cd->repr < 256)	{	  if (cs->description[cd->repr])	    chardesc_free (&cs->description[cd->repr]);	  else	    cs->u_symb++;	  cs->description[cd->repr] = cd;	  cd = NULL;	}      }      else      {	if (cs->u_symb == cs->n_symb)	{	  size_t new_size = cs->n_symb + 256;	  size_t i;	  safe_realloc ((void **) &cs->description, new_size * sizeof (CHARDESC *));	  for (i = cs->u_symb; i < new_size; i++)	    cs->description[i] = NULL;	  cs->n_symb = new_size;	}	cs->description[cs->u_symb++] = cd;	cd = NULL;      }    }    chardesc_free (&cd);  }  if (multbyte)    qsort (cs->description, cs->u_symb, sizeof (CHARDESC *), _cd_compar);  rv = 0;bail:  charmap_free (&m);  if (fp)    fclose (fp);  if (rv)    charset_free (csp);  return rv;}