* xmlHashAddEntry: * @hash: hash table * @key: string key * @payload: pointer to the payload * * Add a hash table entry. If an entry with this key already exists, * payload will not be updated and -1 is returned. This return value * can't be distinguished from out-of-memory errors, so this function * should be used with care. * * NOTE: This function doesn't allow to distinguish malloc fa
| 678 | * Returns 0 on success and -1 in case of error. |
| 679 | */ |
| 680 | int |
| 681 | xmlHashAddEntry(xmlHashTablePtr hash, const xmlChar *key, void *payload) { |
| 682 | int res = xmlHashUpdateInternal(hash, key, NULL, NULL, payload, NULL, 0); |
| 683 | |
| 684 | if (res == 0) |
| 685 | res = -1; |
| 686 | else if (res == 1) |
| 687 | res = 0; |
| 688 | |
| 689 | return(res); |
| 690 | } |
| 691 | |
| 692 | /** |
| 693 | * xmlHashAddEntry2: |