forked from agorise/c-ipfs
50ffade515
Added flatfs, as well as fixed some memory leaks. Valgrind across tests now reports 0 memory leaks.
31 lines
951 B
C
31 lines
951 B
C
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "ipfs/commands/argument.h"
|
|
|
|
int commands_argument_free(struct Argument* argument) {
|
|
free(argument);
|
|
return 1;
|
|
}
|
|
|
|
int commands_argument_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
|
|
argument->name = name;
|
|
argument->required = required;
|
|
argument->variadic = variadic;
|
|
argument->description = description;
|
|
return 1;
|
|
}
|
|
|
|
int commands_argument_string_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
|
|
int retVal = commands_argument_init(argument, name, required, variadic, description);
|
|
if (retVal)
|
|
argument->type = string;
|
|
return retVal;
|
|
}
|
|
|
|
int commands_argument_file_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
|
|
int retVal = commands_argument_init(argument, name, required, variadic, description);
|
|
if (retVal)
|
|
argument->type = file;
|
|
return retVal;
|
|
}
|