Skip to content

Commit 3b20ccd

Browse files
thg2kGirgias
authored andcommitted
ext/session: code cleanup - don't use tabs for alignments
1 parent a680273 commit 3b20ccd

4 files changed

Lines changed: 46 additions & 46 deletions

File tree

ext/session/mod_mm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040

4141
typedef struct ps_sd {
4242
struct ps_sd *next;
43-
uint32_t hv; /* hash value of key */
44-
time_t ctime; /* time of last change */
43+
uint32_t hv; /* hash value of key */
44+
time_t ctime; /* time of last change */
4545
void *data;
46-
size_t datalen; /* amount of valid data */
47-
size_t alloclen; /* amount of allocated memory for data */
46+
size_t datalen; /* amount of valid data */
47+
size_t alloclen; /* amount of allocated memory for data */
4848
zend_string *key;
4949
} ps_sd;
5050

ext/session/mod_user_class.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "php.h"
1818
#include "php_session.h"
1919

20-
#define PS_SANITY_CHECK \
20+
#define PS_SANITY_CHECK \
2121
if (PS(session_status) != php_session_active) { \
2222
zend_throw_error(NULL, "Session is not active"); \
2323
RETURN_THROWS(); \
@@ -27,11 +27,11 @@
2727
RETURN_THROWS(); \
2828
}
2929

30-
#define PS_SANITY_CHECK_IS_OPEN \
30+
#define PS_SANITY_CHECK_IS_OPEN \
3131
PS_SANITY_CHECK; \
32-
if (!PS(mod_user_is_open)) { \
33-
php_error_docref(NULL, E_WARNING, "Parent session handler is not open"); \
34-
RETURN_FALSE; \
32+
if (!PS(mod_user_is_open)) { \
33+
php_error_docref(NULL, E_WARNING, "Parent session handler is not open"); \
34+
RETURN_FALSE; \
3535
}
3636

3737
PHP_METHOD(SessionHandler, open)

ext/session/php_session.h

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ typedef struct ps_module_struct {
5252
#define PS_GET_MOD_DATA() *mod_data
5353
#define PS_SET_MOD_DATA(a) *mod_data = (a)
5454

55-
#define PS_OPEN_FUNC(x) zend_result ps_open_##x(PS_OPEN_ARGS)
56-
#define PS_CLOSE_FUNC(x) zend_result ps_close_##x(PS_CLOSE_ARGS)
57-
#define PS_READ_FUNC(x) zend_result ps_read_##x(PS_READ_ARGS)
58-
#define PS_WRITE_FUNC(x) zend_result ps_write_##x(PS_WRITE_ARGS)
59-
#define PS_DESTROY_FUNC(x) zend_result ps_delete_##x(PS_DESTROY_ARGS)
60-
#define PS_GC_FUNC(x) zend_long ps_gc_##x(PS_GC_ARGS)
61-
#define PS_CREATE_SID_FUNC(x) zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS)
62-
#define PS_VALIDATE_SID_FUNC(x) zend_result ps_validate_sid_##x(PS_VALIDATE_SID_ARGS)
63-
#define PS_UPDATE_TIMESTAMP_FUNC(x) zend_result ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS)
55+
#define PS_OPEN_FUNC(x) zend_result ps_open_##x(PS_OPEN_ARGS)
56+
#define PS_CLOSE_FUNC(x) zend_result ps_close_##x(PS_CLOSE_ARGS)
57+
#define PS_READ_FUNC(x) zend_result ps_read_##x(PS_READ_ARGS)
58+
#define PS_WRITE_FUNC(x) zend_result ps_write_##x(PS_WRITE_ARGS)
59+
#define PS_DESTROY_FUNC(x) zend_result ps_delete_##x(PS_DESTROY_ARGS)
60+
#define PS_GC_FUNC(x) zend_long ps_gc_##x(PS_GC_ARGS)
61+
#define PS_CREATE_SID_FUNC(x) zend_string *ps_create_sid_##x(PS_CREATE_SID_ARGS)
62+
#define PS_VALIDATE_SID_FUNC(x) zend_result ps_validate_sid_##x(PS_VALIDATE_SID_ARGS)
63+
#define PS_UPDATE_TIMESTAMP_FUNC(x) zend_result ps_update_timestamp_##x(PS_UPDATE_TIMESTAMP_ARGS)
6464

6565
/* Save handler module definitions without timestamp enabled */
6666
#define PS_FUNCS(x) \
@@ -69,7 +69,7 @@ typedef struct ps_module_struct {
6969
PS_READ_FUNC(x); \
7070
PS_WRITE_FUNC(x); \
7171
PS_DESTROY_FUNC(x); \
72-
PS_GC_FUNC(x); \
72+
PS_GC_FUNC(x); \
7373
PS_CREATE_SID_FUNC(x); \
7474
PS_VALIDATE_SID_FUNC(x);
7575

@@ -115,8 +115,8 @@ typedef struct _php_session_rfc1867_progress {
115115

116116
zval data; /* the array exported to session data */
117117
zval files; /* data["files"] array */
118-
zval *post_bytes_processed; /* data["bytes_processed"] */
119-
zval *current_file_bytes_processed;
118+
zval *post_bytes_processed; /* data["bytes_processed"] */
119+
zval *current_file_bytes_processed;
120120
zval current_file; /* array of currently uploading file */
121121
} php_session_rfc1867_progress;
122122

@@ -256,22 +256,22 @@ PHPAPI zend_result php_session_reset_id(void);
256256

257257
/* Do not use a return statement in `code` because that may leak memory.
258258
* Break out of the loop instead. */
259-
#define PS_ENCODE_LOOP(code) do { \
260-
zval _zv; \
261-
/* protect against user interference */ \
262-
ZVAL_COPY(&_zv, Z_REFVAL(PS(http_session_vars))); \
259+
#define PS_ENCODE_LOOP(code) do { \
260+
zval _zv; \
261+
/* protect against user interference */ \
262+
ZVAL_COPY(&_zv, Z_REFVAL(PS(http_session_vars))); \
263263
ZEND_HASH_FOREACH_KEY(Z_ARRVAL(_zv), zend_ulong num_key, zend_string * key) { \
264-
if (key == NULL) { \
265-
php_error_docref(NULL, E_WARNING, \
266-
"Skipping numeric key " ZEND_LONG_FMT, num_key);\
267-
continue; \
268-
} \
269-
zval *struc = php_get_session_var(key); \
270-
if (struc) { \
271-
code; \
272-
} \
273-
} ZEND_HASH_FOREACH_END(); \
274-
zval_ptr_dtor(&_zv); \
264+
if (key == NULL) { \
265+
php_error_docref(NULL, E_WARNING, \
266+
"Skipping numeric key " ZEND_LONG_FMT, num_key); \
267+
continue; \
268+
} \
269+
zval *struc = php_get_session_var(key); \
270+
if (struc) { \
271+
code; \
272+
} \
273+
} ZEND_HASH_FOREACH_END(); \
274+
zval_ptr_dtor(&_zv); \
275275
} while(0)
276276

277277
PHPAPI ZEND_EXTERN_MODULE_GLOBALS(ps)

ext/session/session.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ zend_class_entry *php_session_update_timestamp_iface_entry;
8383
#define IF_SESSION_VARS() \
8484
if (Z_ISREF_P(&PS(http_session_vars)) && Z_TYPE_P(Z_REFVAL(PS(http_session_vars))) == IS_ARRAY)
8585

86-
#define SESSION_CHECK_ACTIVE_STATE \
87-
if (PS(session_status) == php_session_active) { \
88-
php_session_session_already_started_error(E_WARNING, "Session ini settings cannot be changed when a session is active"); \
89-
return FAILURE; \
86+
#define SESSION_CHECK_ACTIVE_STATE \
87+
if (PS(session_status) == php_session_active) { \
88+
php_session_session_already_started_error(E_WARNING, "Session ini settings cannot be changed when a session is active"); \
89+
return FAILURE; \
9090
}
9191

92-
#define SESSION_CHECK_OUTPUT_STATE \
93-
if (SG(headers_sent) && stage != ZEND_INI_STAGE_DEACTIVATE) { \
94-
php_session_headers_already_sent_error(E_WARNING, "Session ini settings cannot be changed after headers have already been sent"); \
95-
return FAILURE; \
92+
#define SESSION_CHECK_OUTPUT_STATE \
93+
if (SG(headers_sent) && stage != ZEND_INI_STAGE_DEACTIVATE) { \
94+
php_session_headers_already_sent_error(E_WARNING, "Session ini settings cannot be changed after headers have already been sent"); \
95+
return FAILURE; \
9696
}
9797

9898
#define SESSION_FORBIDDEN_CHARS "=,;.[ \t\r\n\013\014"
@@ -1408,8 +1408,8 @@ static zend_result php_session_send_cookie(void)
14081408
smart_str_0(&ncookie);
14091409

14101410
php_session_remove_cookie(); /* remove already sent session ID cookie */
1411-
/* 'replace' must be 0 here, else a previous Set-Cookie
1412-
header, probably sent with setcookie() will be replaced! */
1411+
/* 'replace' must be 0 here, else a previous Set-Cookie
1412+
header, probably sent with setcookie() will be replaced! */
14131413
sapi_add_header_ex(estrndup(ZSTR_VAL(ncookie.s), ZSTR_LEN(ncookie.s)), ZSTR_LEN(ncookie.s), false, false);
14141414
smart_str_free(&ncookie);
14151415

0 commit comments

Comments
 (0)