1/* $FreeBSD: head/lib/libc/iconv/citrus_db_factory.c 267437 2014-06-13 08:28:51Z tijl $ */ |
2/* $NetBSD: citrus_db_factory.c,v 1.10 2013/09/14 13:05:51 joerg Exp $ */ 3 4/*- 5 * Copyright (c)2003 Citrus Project, 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 255 unchanged lines hidden (view full) --- 265 266 ofs = 0; 267 /* check whether more than 0 entries exist */ 268 if (df->df_num_entries == 0) { 269 dump_header(r, magic, &ofs, 0); 270 return (0); 271 } 272 /* allocate hash table */ |
273 depp = calloc(df->df_num_entries, sizeof(*depp)); |
274 if (depp == NULL) 275 return (-1); |
276 277 /* step1: store the entries which are not conflicting */ 278 STAILQ_FOREACH(de, &df->df_entries, de_entry) { 279 de->de_hashvalue %= df->df_num_entries; 280 de->de_idx = -1; 281 de->de_next = NULL; 282 if (depp[de->de_hashvalue] == NULL) { 283 depp[de->de_hashvalue] = de; --- 54 unchanged lines hidden --- |