Remove complicated checks after memory allocation and in case of error print to stderr instead. This makes the memory allocation functions more natural to use.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
u64 count_lines (hashcat_ctx_t *hashcat_ctx, FILE *fd);
|
||||
u64 count_lines (FILE *fd);
|
||||
|
||||
int fgetl (FILE *fp, char *line_buf);
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ int count_dictionaries (char **dictionary_files);
|
||||
|
||||
char *first_file_in_directory (const char *path);
|
||||
|
||||
char **scan_directory (hashcat_ctx_t *hashcat_ctx, const char *path);
|
||||
char **scan_directory (const char *path);
|
||||
|
||||
int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *install_folder, MAYBE_UNUSED const char *shared_folder);
|
||||
void folder_config_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
+4
-6
@@ -12,12 +12,10 @@
|
||||
|
||||
#define MSG_ENOMEM "Insufficient memory available"
|
||||
|
||||
#define VERIFY_PTR(v) if ((v) == NULL) return -1;
|
||||
|
||||
void *hccalloc (hashcat_ctx_t *hashcat_ctx, const size_t nmemb, const size_t sz);
|
||||
void *hcmalloc (hashcat_ctx_t *hashcat_ctx, const size_t sz);
|
||||
void *hcrealloc (hashcat_ctx_t *hashcat_ctx, void *ptr, const size_t oldsz, const size_t addsz);
|
||||
char *hcstrdup (hashcat_ctx_t *hashcat_ctx, const char *s);
|
||||
void *hccalloc (const size_t nmemb, const size_t sz);
|
||||
void *hcmalloc (const size_t sz);
|
||||
void *hcrealloc (void *ptr, const size_t oldsz, const size_t addsz);
|
||||
char *hcstrdup (const char *s);
|
||||
void hcfree (void *ptr);
|
||||
|
||||
#endif // _MEMORY_H
|
||||
|
||||
Reference in New Issue
Block a user