Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
feat: added extra validation for chefobject get functions.
Browse files Browse the repository at this point in the history
* Added extra validation for functions that retrieve certain information
  from a given chef object.
  • Loading branch information
QingTian1927 committed Mar 12, 2024
1 parent ccfac99 commit 5b7b632
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/chefobject/chefobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,29 @@ int setAll(
}

char* getName(chefObj* chef) {
if (chef == NULL) { return NULL; }

char* name = chef->name;
return name;
}

char* getRole(chefObj* chef) {
if (chef == NULL) { return NULL; }

char* role = chef->role;
return role;
}

char* getDateOfBirth(chefObj* chef) {
if (chef == NULL) { return NULL; }

char* dateOfBirth = chef->dateOfBirth;
return dateOfBirth;
}

long getSalary(chefObj* chef) {
if (chef == NULL) { return -1; }

long salary = chef->salary;
return salary;
}

0 comments on commit 5b7b632

Please sign in to comment.