Skip to content

Commit

Permalink
enhancement: #2 инициализация связного списка 'вперёд'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ya-Pasha-364shy committed May 4, 2023
1 parent c4c5511 commit 2466ed1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion helpers/helpers_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ static void handle_event(queue_entry_t event, thread_argument_t * arg)
{
thread_directory = opendir(hi->value);
if (thread_directory && !backup_helpers_find_file(cur_event_filename, thread_directory))
{
{
hi = hi->previous;
continue;
}
Expand Down
8 changes: 5 additions & 3 deletions helpers/helpers_hash_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@ static hash_item_t * __hash_item_create(char * value)
hash_item_t * hash_item = (hash_item_t *)malloc(sizeof(hash_item_t));
memset(hash_item, 0, sizeof(hash_item_t));

hash_item->value = (char *)malloc(sizeof(char) * value_len);
hash_item->value = (char *)malloc(sizeof(char) * value_len);
memset(hash_item->value, 0, sizeof(char) * value_len);
strncpy(hash_item->value, value, value_len);

hash_t key = __hash_key_generator(value);
hash_t key = __hash_key_generator(value);
if (key >= 0 && key <= 1.1)
{
printf("Error: This path to file is too big !\n");
return NULL;
}
else
{
hash_item->key = key;
hash_item->key = key;
hash_item->previous = NULL;
hash_item->next = NULL;

return hash_item;
}
Expand Down Expand Up @@ -130,6 +131,7 @@ unsigned int hash_table_insert_item(hash_table_t * this, char * value)
}
else
{
this->node->next = (void *)item;
item->previous = this->node;
this->node = (void *)item;
}
Expand Down
1 change: 1 addition & 0 deletions include/helpers/helpers_hash_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef struct hash_item_s
char * value;

void * previous;
void * next;
} hash_item_t;

typedef struct hash_table_s
Expand Down

0 comments on commit 2466ed1

Please sign in to comment.