1,5 → 1,5 |
/* |
* Copyright (c) 2008 Lukas Mejdrech |
* Copyright (c) 2009 Lukas Mejdrech |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
31,7 → 31,8 |
*/ |
|
/** @file |
* A character string to integer map implementation file. |
* Character string to integer map implementation. |
* @see char_map.h |
*/ |
|
#include <errno.h> |
41,7 → 42,7 |
|
#include "char_map.h" |
|
/** An internal magic value for a consistency check. |
/** Internal magic value for a consistency check. |
*/ |
#define CHAR_MAP_MAGIC_VALUE 0x12345611 |
|
48,11 → 49,11 |
/** Adds the value with the key to the map. |
* Creates new nodes to map the key. |
* @param map The character string to integer map. Input/output parameter. |
* @param identifier The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. Input parameter. |
* @param length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. Input parameter. |
* @param identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found. Input parameter. |
* @param length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found. Input parameter. |
* @param value The integral value to be stored for the key character string. Input parameter. |
* @returns EOK on success. |
* @returns ENOMEM if there is no memory left. |
* @returns ENOMEM if there is not enough memory left. |
* @returns EEXIST if the key character string is already used. |
*/ |
int char_map_add_item( char_map_ref map, const char * identifier, size_t length, const int value ); |
59,8 → 60,8 |
|
/** Returns the node assigned to the key from the map. |
* @param map The character string to integer map. Input parameter. |
* @param identifier The key zero ('\0') terminated character string. The key character string is processed until the first terminating zero ('\0') character after the given length is found. Input parameter. |
* @param length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\0') character is found. Input parameter. |
* @param identifier The key zero ('\\0') terminated character string. The key character string is processed until the first terminating zero ('\\0') character after the given length is found. Input parameter. |
* @param length The key character string length. The parameter may be zero (0) which means that the string is processed until the terminating zero ('\\0') character is found. Input parameter. |
* @returns The node holding the integral value assigned to the key character string. |
* @returns NULL if the key is not assigned a node. |
*/ |