<commit_before>/*
 ============================================================================
 Name        : hstr_favorites.c
 Author      : <EMAIL>
 Copyright   : Apache 2.0
 Description : Favorite commands.
 ============================================================================
*/

#include "include/hstr_favorites.h"

#define FAVORITE_SEGMENT_SIZE 10

void favorites_init(FavoriteItems *favorites) {
	favorites->items=NULL;
	favorites->count=0;
}

void favorites_load(FavoriteItems *favorites) {
	// TODO fake initialization instead of .hhrc load
	favorites->count=3;
	favorites->items=malloc(sizeof(char *)*favorites->count);
	favorites->items[0]="a";
	favorites->items[1]="b";
	favorites->items[2]="c";
}

void favorites_add(FavoriteItems *favorites, char *newFavorite) {
	favorites->items=realloc(favorites->items, sizeof(char *)*favorites->count);
	favorites->items[favorites->count++]=newFavorite;
}

void favorites_save(FavoriteItems *favorites) {
}
<commit_msg>Fake in-memory favorites work without adding and load/save.<commit_after>/*
 ============================================================================
 Name        : hstr_favorites.c
 Author      : <EMAIL>
 Copyright   : Apache 2.0
 Description : Favorite commands.
 ============================================================================
*/

#include <string.h>
#include "include/hstr_favorites.h"

#define FAVORITE_SEGMENT_SIZE 10

void favorites_init(FavoriteItems *favorites)
{
	favorites->items=NULL;
	favorites->count=0;
}

void favorites_load(FavoriteItems *favorites)
{
	// TODO fake initialization instead of .hhrc load
	favorites->count=2;
	favorites->items=malloc(sizeof(char *)*favorites->count);
	favorites->items[0]=malloc(2);
	strcpy(favorites->items[0],"a");
	favorites->items[1]=malloc(2);
	strcpy(favorites->items[1],"b");
}

void favorites_add(FavoriteItems *favorites, char *newFavorite)
{
	favorites->items=realloc(favorites->items, sizeof(char *)*favorites->count);
	favorites->items[favorites->count++]=newFavorite;

	favorites_save(favorites);
}

void favorites_save(FavoriteItems *favorites)
{
}

{'fraction_non_alphanumeric': 0.26837363679468945, 'fraction_numerical': 0.00995732574679943, 'mean_word_length': 6.873134328358209, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5768953', 'n_tokens_mistral': 706, 'n_tokens_neox': 678, 'n_words': 109}