More work on storage and cleanup

Added flatfs, as well as fixed some memory leaks. Valgrind across tests
now reports 0 memory leaks.
This commit is contained in:
John Jones 2016-11-28 08:09:00 -05:00
parent 63c7bd72e2
commit 50ffade515
28 changed files with 580 additions and 93 deletions

View file

@ -12,7 +12,7 @@
#include "swarm.h"
struct Addresses {
struct SwarmAddresses swarm;
struct SwarmAddresses* swarm;
char* api;
char* gateway;
};
@ -24,10 +24,10 @@ struct Addresses {
* @param gateway the gateway address (like "ip4/127.0.0.1/tcp/8080")
* @returns true(1) on success, otherwise false(0)
*/
int repo_config_addresses_init(struct Addresses* addresses, char* api, char* gateway);
int repo_config_addresses_new(struct Addresses** addresses, char* api, char* gateway);
/**
* clear any memory allocated by a address_init call
* clear any memory allocated by a address_new call
* @param addresses the struct
* @returns true(1)
*/

View file

@ -31,15 +31,15 @@ struct Reprovider {
};
struct RepoConfig {
struct Identity identity;
struct Datastore datastore;
struct Addresses addresses;
struct Identity* identity;
struct Datastore* datastore;
struct Addresses* addresses;
struct Mounts mounts;
struct Discovery discovery;
struct Ipns ipns;
struct BootstrapPeers peer_addresses;
//struct tour tour;
struct Gateway gateway;
struct Gateway* gateway;
//struct supernode_routing supernode_client_config;
//struct api api;
struct Reprovider reprovider;

View file

@ -28,9 +28,13 @@ struct Gateway {
char* root_redirect;
int writable;
struct PathPrefixes path_prefixes;
struct HTTPHeaders http_headers;
struct HTTPHeaders* http_headers;
};
int repo_config_gateway_http_header_init(struct HTTPHeaders* http_headers, char** headers, char** values, int num_elements);
int repo_config_gateway_new(struct Gateway** gateway);
int repo_config_gateway_free(struct Gateway* gateway);
#endif /* gateway_h */

View file

@ -23,8 +23,9 @@ struct SwarmAddresses {
*/
int repo_config_swarm_address_init(struct SwarmAddresses* swarm_addresses, char** addresses, int array_length);
int repo_config_swarm_address_new(struct SwarmAddresses** swarm_addresses);
/***
* free up memory from repo_config_swarm_address_init
* free up memory from repo_config_swarm_address_new
* @param swarm_addresses the structure
* @returns true(1)
*/