if (! replace)
if (namehashtab[idx].locrec_offset != 0 && ! replace)
add_locale_to_archive (ah, name, data, replace)     struct locarhandle *ah;     const char *name;     locale_data_t data;     bool replace;{  /* First look for the name.  If it already exists and we are not     supposed to replace it don't do anything.  If it does not exist     we have to allocate a new locale record.  */  size_t name_len = strlen (name);  uint32_t file_offsets[__LC_LAST];  unsigned int num_new_offsets = 0;  struct sumhashent *sumhashtab;  uint32_t hval;  unsigned int cnt;  unsigned int idx;  unsigned int insert_idx;  struct locarhead *head;  struct namehashent *namehashtab;  struct namehashent *namehashent;  unsigned int incr;  struct locrecent *locrecent;  head = ah->addr;  sumhashtab = (struct sumhashent *) ((char *) ah->addr				      + head->sumhash_offset);  namehashtab = (struct namehashent *) ((char *) ah->addr					+ head->namehash_offset);  /* For each locale category data set determine whether the same data     is already somewhere in the archive.  */  for (cnt = 0; cnt < __LC_LAST; ++cnt)    if (cnt != LC_ALL)      {	/* By default signal that we have no data.  */	file_offsets[cnt] = 0;	++num_new_offsets;	/* Compute the hash value of the checksum to determine a	   starting point for the search in the MD5 hash value	   table.  */	hval = compute_hashval (data[cnt].sum, 16);	idx = hval % head->sumhash_size;	incr = 1 + hval % (head->sumhash_size - 2);	while (sumhashtab[idx].file_offset != 0)	  {	    if (memcmp (data[cnt].sum, sumhashtab[idx].sum, 16) == 0)	      {		/* Found it.  */		file_offsets[cnt] = sumhashtab[idx].file_offset;		--num_new_offsets;		break;	      }	    idx += incr;	    if (idx >= head->sumhash_size)	      idx -= head->sumhash_size;	  }      }  /* Hash value of the locale name.  */  hval = compute_hashval (name, name_len);  insert_idx = -1;  idx = hval % head->namehash_size;  incr = 1 + hval % (head->namehash_size - 2);  /* If the name_offset field is zero this means this is no     deleted entry and therefore no entry can be found.  */  while (namehashtab[idx].name_offset != 0)    {      if (namehashtab[idx].hashval == hval	  && strcmp (name,		     (char *) ah->addr + namehashtab[idx].name_offset) == 0)	{	  /* Found the entry.  */	  if (! replace)	    {	      if (! be_quiet)		error (0, 0, _("locale '%s' already exists"), name);	      return 1;	    }	  break;	}      /* Remember the first place we can insert the new entry.  */      if (namehashtab[idx].locrec_offset == 0 && insert_idx == -1)	insert_idx = idx;      idx += incr;      if (idx >= head->namehash_size)	idx -= head->namehash_size;    }  /* Add as early as possible.  */  if (insert_idx != -1)    idx = insert_idx;  namehashent = &namehashtab[idx];  /* Determine whether we have to resize the file.  */  if (100 * (head->sumhash_used + num_new_offsets) > 75 * head->sumhash_size      || (namehashent->locrec_offset == 0	  && (head->locrectab_used == head->locrectab_size	      || head->string_used + name_len + 1 > head->string_size	      || 100 * head->namehash_used > 75 * head->namehash_size)))    {      /* The current archive is not large enough.  */      enlarge_archive (ah, head);      return add_locale_to_archive (ah, name, data, replace);    }  /* Add the locale data which is not yet in the archive.  */  for (cnt = 0; cnt < __LC_LAST; ++cnt)    if (cnt != LC_ALL && file_offsets[cnt] == 0)      {	/* The data for this section is not yet available in the	   archive.  Append it.  */	off64_t lastpos;	uint32_t md5hval;	lastpos = lseek64 (ah->fd, 0, SEEK_END);	if (lastpos == (off64_t) -1)	  error (EXIT_FAILURE, errno, _("cannot add to locale archive"));	/* Align all data to a 16 byte boundary.  */	if ((lastpos & 15) != 0)	  {	    static const char zeros[15] = { 0, };	    if (TEMP_FAILURE_RETRY (write (ah->fd, zeros, 16 - (lastpos & 15)))		!= 16 - (lastpos & 15))	      error (EXIT_FAILURE, errno, _("cannot add to locale archive"));	    lastpos += 16 - (lastpos & 15);	  }	/* Remember the position.  */	file_offsets[cnt] = lastpos;	/* Write the data.  */	if (TEMP_FAILURE_RETRY (write (ah->fd, data[cnt].addr, data[cnt].size))	    != data[cnt].size)	  error (EXIT_FAILURE, errno, _("cannot add to locale archive"));	/* Add the hash value to the hash table.  */	md5hval = compute_hashval (data[cnt].sum, 16);	idx = md5hval % head->sumhash_size;	incr = 1 + md5hval % (head->sumhash_size - 2);	while (sumhashtab[idx].file_offset != 0)	  {	    idx += incr;	    if (idx >= head->sumhash_size)	      idx -= head->sumhash_size;	  }	memcpy (sumhashtab[idx].sum, data[cnt].sum, 16);	sumhashtab[idx].file_offset = file_offsets[cnt];	++head->sumhash_used;      }  if (namehashent->locrec_offset == 0)    {      /* Add the name string.  */      memcpy ((char *) ah->addr + head->string_offset + head->string_used,	      name, name_len + 1);      namehashent->name_offset = head->string_offset + head->string_used;      head->string_used += name_len + 1;      /* Allocate a name location record.  */      namehashent->locrec_offset = (head->locrectab_offset				    + (head->locrectab_used++				       * sizeof (struct locrecent)));      namehashent->hashval = hval;      ++head->namehash_used;    }  /* Fill in the table with the locations of the locale data.  */  locrecent = (struct locrecent *) ((char *) ah->addr				    + namehashent->locrec_offset);  for (cnt = 0; cnt < __LC_LAST; ++cnt)    if (cnt != LC_ALL)      {	locrecent->record[cnt].offset = file_offsets[cnt];	locrecent->record[cnt].len = data[cnt].size;      }  /* Read the locale.alias file to see whether any matching record is     found.  If an entry is available check whether it is already in     the archive.  If this is the case check whether the new locale's     name is more specific than the one currently referred to by the     alias.  */  return 0;}