Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce test_calloc and alloc #172

Merged
merged 1 commit into from
Mar 17, 2024
Merged

Introduce test_calloc and alloc #172

merged 1 commit into from
Mar 17, 2024

Conversation

komark06
Copy link
Contributor

This commit introduces a generic alloc function to handle both test_malloc and test_calloc operations based on the provided alloc_func_t. Additionally, it implements the test_calloc function to allocate memory and initialize it to zero.

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revise the subject of git commit message and pull request.

Quote from Wikipedia:
"code refactoring is the process of restructuring existing computer code — changing the factoring — without changing its external behavior."

It is evident that the external behavior is changed since the introduction of callc harness hook.

@komark06 komark06 changed the title Refactor test_calloc and introduce alloc Introduce test_calloc and alloc Mar 17, 2024
@komark06
Copy link
Contributor Author

Thank you for your review. I've updated the subject for both the git commit message and the pull request.

harness.c Outdated Show resolved Hide resolved
harness.c Outdated Show resolved Hide resolved
harness.c Outdated Show resolved Hide resolved
TEST_MALLOC,
TEST_CALLOC,
} alloc_t;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Remove the value associated with the enum to avoid the need to change its order.
  • Rename alloc_func_t to alloc_t for clarity.

harness.c Outdated Show resolved Hide resolved
harness.c Outdated Show resolved Hide resolved
harness.c Outdated Show resolved Hide resolved
harness.c Outdated Show resolved Hide resolved
@komark06
Copy link
Contributor Author

Improve error messaging and precisely rename variables.

This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
@jserv jserv merged commit f087e77 into sysprog21:master Mar 17, 2024
1 of 2 checks passed
@jserv
Copy link
Contributor

jserv commented Mar 17, 2024

Thank @komark06 for contributing. Be aware of the amended subject.

@komark06
Copy link
Contributor Author

Thank you for your feedback.

Booker-Chen pushed a commit to Booker-Chen/lab0-c that referenced this pull request Mar 20, 2024
This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
Han1018 pushed a commit to Han1018/lab0-c that referenced this pull request Mar 21, 2024
This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
ssheep773 pushed a commit to ssheep773/lab0-c that referenced this pull request Mar 21, 2024
This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
Libright1558 pushed a commit to Libright1558/lab0-c that referenced this pull request Mar 24, 2024
This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
RRbell1027 pushed a commit to RRbell1027/lab0-c that referenced this pull request Mar 25, 2024
This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
bclegend pushed a commit to bclegend/lab0-c that referenced this pull request Mar 25, 2024
This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
ihost1002 pushed a commit to ihost1002/lab0-c that referenced this pull request Mar 27, 2024
This commit introduces a generic alloc function to handle both
test_malloc and test_calloc operations based on the provided
alloc_func_t. Additionally, it implements the test_calloc function to
allocate memory and initialize it to zero.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants