Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
dixyes committed May 29, 2024
1 parent e6829a6 commit c860294
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
18 changes: 9 additions & 9 deletions php_micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,14 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_micro_open_self, 0)
ZEND_END_ARG_INFO()

// clang-format off

#ifdef PHP_WIN32
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_realloc_console, 0, 0, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, alloc, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
#endif // PHP_WIN32

// clang-format off

static const zend_function_entry additional_functions[] = {
#ifdef _DEBUG
// debug functions
Expand Down Expand Up @@ -451,23 +451,23 @@ static void micro_register_file_handles(void) /* {{{ */
Z_CONSTANT_FLAGS(ic.value) = 0;
#else
ZEND_CONSTANT_SET_FLAGS(&ic, CONST_CS, 0);
#endif //PHP_VERSION_ID >= 80300
#endif // PHP_VERSION_ID >= 80300
ic.name = zend_string_init_interned("STDIN", sizeof("STDIN") - 1, 0);
zend_register_constant(&ic);

#if PHP_VERSION_ID >= 80300
Z_CONSTANT_FLAGS(oc.value) = 0;
#else
ZEND_CONSTANT_SET_FLAGS(&oc, CONST_CS, 0);
#endif //PHP_VERSION_ID >= 80300
#endif // PHP_VERSION_ID >= 80300
oc.name = zend_string_init_interned("STDOUT", sizeof("STDOUT") - 1, 0);
zend_register_constant(&oc);

#if PHP_VERSION_ID >= 80300
Z_CONSTANT_FLAGS(ec.value) = 0;
#else
ZEND_CONSTANT_SET_FLAGS(&ec, CONST_CS, 0);
#endif //PHP_VERSION_ID >= 80300
#endif // PHP_VERSION_ID >= 80300
ec.name = zend_string_init_interned("STDERR", sizeof("STDERR") - 1, 0);
zend_register_constant(&ec);
}
Expand All @@ -485,10 +485,10 @@ int main(int argc, char *argv[])
#endif
{

# ifdef PHP_MICRO_WIN32_NO_CONSOLE
int argc = __argc;
char **argv = __argv;
# endif
#ifdef PHP_MICRO_WIN32_NO_CONSOLE
int argc = __argc;
char **argv = __argv;
#endif

int exit_status = 0;
#ifdef _DEBUG
Expand Down
2 changes: 1 addition & 1 deletion php_micro.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ limitations under the License.
#define PHP_MICRO_VER_MAJ 0
#define PHP_MICRO_VER_MIN 1
#define PHP_MICRO_VER_PAT 0
//#define PHP_MICRO_VER_APP "nope"
// #define PHP_MICRO_VER_APP "nope"
#ifdef PHP_MICRO_VER_APP
# define PHP_MICRO_VER_STR \
STRINGIZE(PHP_MICRO_VER_MAJ) "." STRINGIZE(PHP_MICRO_VER_MIN) "." STRINGIZE(PHP_MICRO_VER_PAT) "-" PHP_MICRO_VER_APP
Expand Down
6 changes: 3 additions & 3 deletions php_micro_fileinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ typedef Elf32_Phdr Elf_Phdr;
# if defined(__LP64__)
typedef struct mach_header_64 mach_header;
typedef struct segment_command_64 segment_command;
#define MACH_HEADER_MAGIC MH_MAGIC_64
#define LOADCOMMAND_SEGMENT LC_SEGMENT_64
# define MACH_HEADER_MAGIC MH_MAGIC_64
# define LOADCOMMAND_SEGMENT LC_SEGMENT_64
# else
typedef struct mach_header mach_header;
typedef struct segment_command segment_command;
#define LOADCOMMAND_SEGMENT LC_SEGMENT
# define LOADCOMMAND_SEGMENT LC_SEGMENT
# endif
#else
# error because we donot support that platform yet
Expand Down
6 changes: 4 additions & 2 deletions php_micro_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ MICRO_SFX_EXPORT void inspect(void *buf, int len) {
uint8_t *pbuf = buf;
for (uint32_t i = 0; i < len; i += 8) {
printf("%04x:", i);
for (uint8_t j = 0; i + j < len && j < 8; j++) { printf(" %02x", pbuf[i + j]); }
for (uint8_t j = 0; i + j < len && j < 8; j++) {
printf(" %02x", pbuf[i + j]);
}
printf(" ");
for (uint8_t j = 0; i + j < len && j < 8; j++) {
if (' ' <= pbuf[i + j] && pbuf[i + j] < 127) {
Expand Down Expand Up @@ -213,4 +215,4 @@ PHP_FUNCTION(realloc_console) {
RETURN_BOOL(ret);
}

# endif // PHP_WIN32
#endif // PHP_WIN32
2 changes: 1 addition & 1 deletion php_micro_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ PHP_FUNCTION(micro_open_self);
* re-allocate console after console free'd, we can only do this in C because stdio is static varible in MT CRT
*/
PHP_FUNCTION(realloc_console);
# endif // PHP_WIN32
#endif // PHP_WIN32

#endif
3 changes: 2 additions & 1 deletion php_micro_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ int micro_reregister_proto(const char *proto) {
php_stream_wrapper *modified_wrapper = NULL;
int ret = SUCCESS;
HashTable *ht = php_stream_get_url_stream_wrappers_hash_global();
php_stream_wrapper *orig_wrapper = zend_hash_find_ptr(ht, zend_string_init_existing_interned(proto, strlen(proto), 1));
php_stream_wrapper *orig_wrapper =
zend_hash_find_ptr(ht, zend_string_init_existing_interned(proto, strlen(proto), 1));
if (NULL == orig_wrapper) {
// no wrapper found
goto end;
Expand Down

0 comments on commit c860294

Please sign in to comment.