22
22
#include <stdlib.h>
23
23
#include <stdio.h>
24
24
#include <string.h>
25
- #include "../cmd.h"
25
+ #include "../include/ cmd.h"
26
26
#include "string_hash.h"
27
- #include "../debug.h"
27
+ #include "../include/ debug.h"
28
28
29
29
/* defined in ../strbuf.c */
30
30
char * __get_malloced_str (char * str );
@@ -99,8 +99,7 @@ struct hashtab_s *new_hashtable_sz(int size)
99
99
struct hashtab_s * table = malloc (sizeof (struct hashtab_s ));
100
100
if (!table )
101
101
{
102
- PRINT_ERROR ("%s: insufficient memory for creating hash table\n" ,
103
- SOURCE_NAME );
102
+ INSUFFICIENT_MEMORY_ERROR (SHELL_NAME , "creating hash table" );
104
103
return NULL ;
105
104
}
106
105
table -> size = size ; /* use the given size */
@@ -110,8 +109,7 @@ struct hashtab_s *new_hashtable_sz(int size)
110
109
if (!table -> items )
111
110
{
112
111
free (table );
113
- PRINT_ERROR ("%s: insufficient memory for creating hash table\n" ,
114
- SOURCE_NAME );
112
+ INSUFFICIENT_MEMORY_ERROR (SHELL_NAME , "creating hash table" );
115
113
return NULL ;
116
114
}
117
115
memset (table -> items , 0 , itemsz ); /* init buckets list */
@@ -283,7 +281,7 @@ struct hashitem_s *add_hash_item(struct hashtab_s *table, char *key, char *value
283
281
entry = malloc (sizeof (struct hashitem_s ));
284
282
if (!entry )
285
283
{
286
- PRINT_ERROR ("%s: failed to malloc hashtable item\n" , SOURCE_NAME );
284
+ PRINT_ERROR (SHELL_NAME , " failed to malloc hashtable item" );
287
285
return NULL ;
288
286
}
289
287
/* initialize it */
@@ -332,7 +330,7 @@ struct hashitem_s *add_hash_itemb(struct hashtab_s *table, char *key, long value
332
330
entry = malloc (sizeof (struct hashitem_s ));
333
331
if (!entry )
334
332
{
335
- PRINT_ERROR ("%s: failed to malloc hashtable item\n" , SOURCE_NAME );
333
+ PRINT_ERROR (SHELL_NAME , " failed to malloc hashtable item" );
336
334
return NULL ;
337
335
}
338
336
/* initialize it */
0 commit comments