Skip to content

Commit c984bb4

Browse files
committed
Rename Sysvshm to SysvSharedMemory
1 parent 6c37189 commit c984bb4

File tree

6 files changed

+32
-33
lines changed

6 files changed

+32
-33
lines changed

UPGRADING

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,10 @@ PHP 8.0 UPGRADE NOTES
422422
for `false`.
423423

424424
- Sysvshm:
425-
. shm_attach() will now return an Sysvshm object rather than a resource.
425+
. shm_attach() will now return an SysvSharedMemory object rather than a resource.
426426
Return value checks using is_resource() should be replaced with checks
427427
for `false`. The shm_detach() function no longer has an effect, instead
428-
the Sysvshm instance is automatically destroyed if it is no longer referenced.
428+
the SysvSharedMemory instance is automatically destroyed if it is no longer referenced.
429429

430430
- tidy:
431431
. The $use_include_path parameter, which was not used internally, has been

ext/sysvshm/sysvshm.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "Zend/zend_interfaces.h"
3333
#include "php_ini.h"
3434

35-
/* Sysvshm class */
35+
/* SysvSharedMemory class */
3636

3737
zend_class_entry *sysvshm_ce;
3838
static zend_object_handlers sysvshm_object_handlers;
@@ -54,7 +54,7 @@ static zend_object *sysvshm_create_object(zend_class_entry *class_type) {
5454
}
5555

5656
static zend_function *sysvshm_get_constructor(zend_object *object) {
57-
zend_throw_error(NULL, "Cannot directly construct Sysvshm, use shm_attach() instead");
57+
zend_throw_error(NULL, "Cannot directly construct SysvSharedMemory, use shm_attach() instead");
5858
return NULL;
5959
}
6060

@@ -100,7 +100,7 @@ static int php_remove_shm_data(sysvshm_chunk_head *ptr, zend_long shm_varpos);
100100
PHP_MINIT_FUNCTION(sysvshm)
101101
{
102102
zend_class_entry ce;
103-
INIT_CLASS_ENTRY(ce, "Sysvshm", class_Sysvshm_methods);
103+
INIT_CLASS_ENTRY(ce, "SysvSharedMemory", class_SysvSharedMemory_methods);
104104
sysvshm_ce = zend_register_internal_class(&ce);
105105
sysvshm_ce->ce_flags |= ZEND_ACC_FINAL;
106106
sysvshm_ce->create_object = sysvshm_create_object;
@@ -185,7 +185,7 @@ PHP_FUNCTION(shm_attach)
185185
}
186186
/* }}} */
187187

188-
/* {{{ proto bool shm_detach(Sysvshm shm_identifier)
188+
/* {{{ proto bool shm_detach(SysvSharedMemory shm_identifier)
189189
Disconnects from shared memory segment */
190190
PHP_FUNCTION(shm_detach)
191191
{
@@ -199,7 +199,7 @@ PHP_FUNCTION(shm_detach)
199199
}
200200
/* }}} */
201201

202-
/* {{{ proto bool shm_remove(Sysvshm shm_identifier)
202+
/* {{{ proto bool shm_remove(SysvSharedMemory shm_identifier)
203203
Removes shared memory from Unix systems */
204204
PHP_FUNCTION(shm_remove)
205205
{
@@ -224,7 +224,7 @@ PHP_FUNCTION(shm_remove)
224224
}
225225
/* }}} */
226226

227-
/* {{{ proto bool shm_put_var(Sysvshm shm_identifier, int variable_key, mixed variable)
227+
/* {{{ proto bool shm_put_var(SysvSharedMemory shm_identifier, int variable_key, mixed variable)
228228
Inserts or updates a variable in shared memory */
229229
PHP_FUNCTION(shm_put_var)
230230
{
@@ -260,7 +260,7 @@ PHP_FUNCTION(shm_put_var)
260260
}
261261
/* }}} */
262262

263-
/* {{{ proto mixed shm_get_var(Sysvshm id, int variable_key)
263+
/* {{{ proto mixed shm_get_var(SysvSharedMemory id, int variable_key)
264264
Returns a variable from shared memory */
265265
PHP_FUNCTION(shm_get_var)
266266
{
@@ -298,7 +298,7 @@ PHP_FUNCTION(shm_get_var)
298298
}
299299
/* }}} */
300300

301-
/* {{{ proto bool shm_has_var(Sysvshm id, int variable_key)
301+
/* {{{ proto bool shm_has_var(SysvSharedMemory id, int variable_key)
302302
Checks whether a specific entry exists */
303303
PHP_FUNCTION(shm_has_var)
304304
{
@@ -316,7 +316,7 @@ PHP_FUNCTION(shm_has_var)
316316
}
317317
/* }}} */
318318

319-
/* {{{ proto bool shm_remove_var(Sysvshm id, int variable_key)
319+
/* {{{ proto bool shm_remove_var(SysvSharedMemory id, int variable_key)
320320
Removes variable from shared memory */
321321
PHP_FUNCTION(shm_remove_var)
322322
{

ext/sysvshm/sysvshm.stub.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22

33
/** @generate-function-entries */
44

5-
final class Sysvshm
5+
final class SysvSharedMemory
66
{
77
}
88

9-
/** @return Sysvshm|false */
10-
function shm_attach(int $key, int $memsize = UNKNOWN, int $perm = 0666): Sysvshm|false {}
9+
function shm_attach(int $key, int $memsize = UNKNOWN, int $perm = 0666): SysvSharedMemory|false {}
1110

12-
function shm_detach(Sysvshm $shm): bool {}
11+
function shm_detach(SysvSharedMemory $shm): bool {}
1312

14-
function shm_has_var(Sysvshm $shm, int $variable_key): bool {}
13+
function shm_has_var(SysvSharedMemory $shm, int $variable_key): bool {}
1514

16-
function shm_remove(Sysvshm $shm): bool {}
15+
function shm_remove(SysvSharedMemory $shm): bool {}
1716

18-
function shm_put_var(Sysvshm $shm, int $variable_key, $variable): bool {}
17+
function shm_put_var(SysvSharedMemory $shm, int $variable_key, $variable): bool {}
1918

2019
/** @return mixed */
21-
function shm_get_var(Sysvshm $shm, int $variable_key) {}
20+
function shm_get_var(SysvSharedMemory $shm, int $variable_key) {}
2221

23-
function shm_remove_var(Sysvshm $shm, int $variable_key): bool {}
22+
function shm_remove_var(SysvSharedMemory $shm, int $variable_key): bool {}

ext/sysvshm/sysvshm_arginfo.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
/* This is a generated file, edit the .stub.php file instead. */
22

3-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_shm_attach, 0, 1, Sysvshm, MAY_BE_FALSE)
3+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_shm_attach, 0, 1, SysvSharedMemory, MAY_BE_FALSE)
44
ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
55
ZEND_ARG_TYPE_INFO(0, memsize, IS_LONG, 0)
66
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, perm, IS_LONG, 0, "0666")
77
ZEND_END_ARG_INFO()
88

99
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_detach, 0, 1, _IS_BOOL, 0)
10-
ZEND_ARG_OBJ_INFO(0, shm, Sysvshm, 0)
10+
ZEND_ARG_OBJ_INFO(0, shm, SysvSharedMemory, 0)
1111
ZEND_END_ARG_INFO()
1212

1313
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_has_var, 0, 2, _IS_BOOL, 0)
14-
ZEND_ARG_OBJ_INFO(0, shm, Sysvshm, 0)
14+
ZEND_ARG_OBJ_INFO(0, shm, SysvSharedMemory, 0)
1515
ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
1616
ZEND_END_ARG_INFO()
1717

1818
#define arginfo_shm_remove arginfo_shm_detach
1919

2020
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_shm_put_var, 0, 3, _IS_BOOL, 0)
21-
ZEND_ARG_OBJ_INFO(0, shm, Sysvshm, 0)
21+
ZEND_ARG_OBJ_INFO(0, shm, SysvSharedMemory, 0)
2222
ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
2323
ZEND_ARG_INFO(0, variable)
2424
ZEND_END_ARG_INFO()
2525

2626
ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_get_var, 0, 0, 2)
27-
ZEND_ARG_OBJ_INFO(0, shm, Sysvshm, 0)
27+
ZEND_ARG_OBJ_INFO(0, shm, SysvSharedMemory, 0)
2828
ZEND_ARG_TYPE_INFO(0, variable_key, IS_LONG, 0)
2929
ZEND_END_ARG_INFO()
3030

@@ -52,6 +52,6 @@ static const zend_function_entry ext_functions[] = {
5252
};
5353

5454

55-
static const zend_function_entry class_Sysvshm_methods[] = {
55+
static const zend_function_entry class_SysvSharedMemory_methods[] = {
5656
ZEND_FE_END
5757
};

ext/sysvshm/tests/002.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ bool(false)
4545

4646
Warning: shm_attach(): Segment size must be greater than zero in %s on line %d
4747
bool(false)
48-
object(Sysvshm)#1 (0) {
48+
object(SysvSharedMemory)#1 (0) {
4949
}
50-
object(Sysvshm)#2 (0) {
50+
object(SysvSharedMemory)#2 (0) {
5151
}
52-
object(Sysvshm)#1 (0) {
52+
object(SysvSharedMemory)#1 (0) {
5353
}
54-
object(Sysvshm)#2 (0) {
54+
object(SysvSharedMemory)#2 (0) {
5555
}
56-
object(Sysvshm)#1 (0) {
56+
object(SysvSharedMemory)#1 (0) {
5757
}
5858
Done

ext/sysvshm/tests/shutdown_crash_0.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ shm_remove($s);
1616
var_dump($s = shm_attach($key, 1024));
1717
shm_remove($s);
1818
--EXPECT--
19-
object(Sysvshm)#1 (0) {
19+
object(SysvSharedMemory)#1 (0) {
2020
}
21-
object(Sysvshm)#2 (0) {
21+
object(SysvSharedMemory)#2 (0) {
2222
}

0 commit comments

Comments
 (0)