Skip to content

Commit df82420

Browse files
committed
Clarify stackman_switch() return value documentation
Made it explicit that stackman_switch() returns the value from the second callback invocation (STACKMAN_OP_RESTORE), not the first. Also fixed typo: 'calback' -> 'callback'.
1 parent d36dfa5 commit df82420

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ void *stackman_call(stackman_cb_t callback, void *context, void *stack);
116116
117117
This is the main _stack manipulation_ API. When called, it will call `callback` function twice:
118118
119-
1. First it calls it with the current opcode `STACKMAN_OP_SAVE`, passing the current `stack_pointer` to
119+
1. First it calls it with the opcode `STACKMAN_OP_SAVE`, passing the current `stack_pointer` to
120120
the callback. This gives the callback the opportunity to _save_ the stack data somewhere. The callback
121121
can then return a **different** stack pointer.
122-
2. It takes the returned value from the calback and replaces the CPU _stack pointer_ with it.
122+
2. It takes the returned value from the callback and replaces the CPU _stack pointer_ with it.
123123
3. It calls the callback a second time, with the opcode `STACKMAN_OP_RESTORE` and the new stack pointer.
124124
This gives the callback the opportunity to replace the data on the stack with previously saved data.
125-
4. It returns the return value from the second call to the callback function.
125+
4. `stackman_switch()` returns the return value from the second callback invocation.
126126
127127
The `context` pointer is passed as-is to the callback, allowing it access to user-defined data.
128128

0 commit comments

Comments
 (0)