Make more use of convenience methods

FossilOrigin-Name: 89fbd7a1520ecb65809b4c1bd10006ce9bb3a662cb7e7804abaf85d1ee1da63a
This commit is contained in:
Jonathan Schleifer 2025-03-20 13:21:56 +00:00
parent 4bdb80410d
commit 34b31eb77f
44 changed files with 320 additions and 188 deletions

View file

@ -20,9 +20,7 @@ alias(OFString *name, OFString *action)
Alias *alias = identifiers[name];
if (alias == nil) {
alias = [[Alias alloc] initWithName:name
action:action
persisted:true];
alias = [Alias aliasWithName:name action:action persisted:true];
if (identifiers == nil)
identifiers = [[OFMutableDictionary alloc] init];
@ -42,12 +40,12 @@ int
variable(OFString *name, int min, int cur, int max, int *storage,
void (*function)(), bool persisted)
{
Variable *variable = [[Variable alloc] initWithName:name
min:min
max:max
storage:storage
function:function
persisted:persisted];
Variable *variable = [Variable variableWithName:name
min:min
max:max
storage:storage
function:function
persisted:persisted];
if (identifiers == nil)
identifiers = [[OFMutableDictionary alloc] init];
@ -89,9 +87,9 @@ getalias(OFString *name)
bool
addcommand(OFString *name, void (*function)(), int argumentsTypes)
{
Command *command = [[Command alloc] initWithName:name
function:function
argumentsTypes:argumentsTypes];
Command *command = [Command commandWithName:name
function:function
argumentsTypes:argumentsTypes];
if (identifiers == nil)
identifiers = [[OFMutableDictionary alloc] init];