mirror of
https://github.com/darlinghq/MachO-Kit.git
synced 2025-02-19 21:10:36 +00:00
Use bool type instead of char for LC_LINKER_OPTION enumeration block
This commit is contained in:
parent
0292c4120d
commit
45204f13bd
@ -106,7 +106,7 @@ SpecBegin(macho_load_command)
|
||||
|
||||
it(@"enumerates using block", ^{
|
||||
__block uint32_t count = 0;
|
||||
mk_load_command_linker_option_enumerate_strings(load_command, ^(const char *string, uint32_t index, char *__unused stop) {
|
||||
mk_load_command_linker_option_enumerate_strings(load_command, ^(const char *string, uint32_t index, bool *__unused stop) {
|
||||
const char *expected_string = (index == 0 ? "-framework" : "CoreFoundation");
|
||||
int cmp = strcmp(string, expected_string);
|
||||
expect(cmp).to.equal(0);
|
||||
@ -118,7 +118,7 @@ SpecBegin(macho_load_command)
|
||||
|
||||
it(@"enumerates using block with stop", ^{
|
||||
__block uint32_t count = 0;
|
||||
mk_load_command_linker_option_enumerate_strings(load_command, ^(const char *string, uint32_t index, char *__unused stop) {
|
||||
mk_load_command_linker_option_enumerate_strings(load_command, ^(const char *string, uint32_t index, bool *__unused stop) {
|
||||
int cmp = strcmp(string, "-framework");
|
||||
expect(cmp).to.equal(0);
|
||||
expect(index).to.equal(0);
|
||||
|
@ -146,7 +146,7 @@ mk_load_command_linker_option_copy_string(mk_load_command_ref load_command, uint
|
||||
#if __BLOCKS__
|
||||
void
|
||||
mk_load_command_linker_option_enumerate_strings(mk_load_command_ref load_command,
|
||||
void (^enumerator)(const char* string, uint32_t index, char* stop))
|
||||
void (^enumerator)(const char* string, uint32_t index, bool* stop))
|
||||
{
|
||||
uint32_t nstrings = mk_load_command_linker_option_get_nstrings(load_command);
|
||||
if (nstrings == UINT32_MAX || enumerator == NULL) {
|
||||
@ -156,7 +156,7 @@ mk_load_command_linker_option_enumerate_strings(mk_load_command_ref load_command
|
||||
for (uint32_t i = 0; i < nstrings; ++i) {
|
||||
const char *string = mk_load_command_linker_option_get_string(load_command, i, NULL);
|
||||
if (string != NULL) {
|
||||
char stop = false;
|
||||
bool stop = false;
|
||||
enumerator(string, i, &stop);
|
||||
if (stop) {
|
||||
break;
|
||||
|
@ -51,7 +51,7 @@ mk_load_command_linker_option_copy_string(mk_load_command_ref load_command, uint
|
||||
//! Iterate over the strings using a block.
|
||||
_mk_export void
|
||||
mk_load_command_linker_option_enumerate_strings(mk_load_command_ref load_command,
|
||||
void (^enumerator)(const char* string, uint32_t index, char* stop));
|
||||
void (^enumerator)(const char* string, uint32_t index, bool* stop));
|
||||
#endif
|
||||
|
||||
//! @} LOAD_COMMANDS !//
|
||||
|
Loading…
x
Reference in New Issue
Block a user