Skip to content

Commit 71e5341

Browse files
committed
Trying to get it to work with CLion.
Added macros.h
1 parent a12eb17 commit 71e5341

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ add_custom_target(extension COMMAND phpize && ./configure && make && make instal
55
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
66

77
set(SOURCE_FILES php_http_message
8-
http_message.c request.c)
8+
http_message.c request.c marcos.h)
99

1010
execute_process (
1111
COMMAND php-config --include-dir

marcos.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
+----------------------------------------------------------------------+
3+
| HTTP Message PHP extension - Marcos |
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) 2019 Arnold Daniels |
6+
+----------------------------------------------------------------------+
7+
| Permission is hereby granted, free of charge, to any person |
8+
| obtaining a copy of this software and associated documentation files |
9+
| (the "Software"), to deal in the Software without restriction, |
10+
| including without limitation the rights to use, copy, modify, merge, |
11+
| publish, distribute, sublicense, and/or sell copies of the Software, |
12+
| and to permit persons to whom the Software is furnished to do so, |
13+
| subject to the following conditions: |
14+
| |
15+
| The above copyright notice and this permission notice shall be |
16+
| included in all copies or substantial portions of the Software. |
17+
| |
18+
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
19+
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
20+
| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
21+
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
22+
| BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
23+
| ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
24+
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
25+
| SOFTWARE. |
26+
+----------------------------------------------------------------------+
27+
| Author: Arnold Daniels <arnold@jasny.net> |
28+
+----------------------------------------------------------------------+
29+
*/
30+
31+
#ifndef HTTP_MESSAGE_MARCOS_H
32+
#define HTTP_MESSAGE_MARCOS_H
33+
34+
#define HTTP_MESSAGE_GET_METHOD(class_name, method_name, scope, property)\
35+
PHP_METHOD(class_name, method_name) {\
36+
zval rv, *obj, *value;\
37+
if (zend_parse_parameters_none() == FAILURE) return;\
38+
value = zend_read_property(scope, getThis(), property, sizeof(property) - 1, 0, &rv);\
39+
RETURN_ZVAL(value, 1, 0);\
40+
}
41+
42+
#endif //HTTP_MESSAGE_MARCOS_H

request.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ ZEND_END_ARG_INFO()
5252

5353
zend_class_entry *request_ce;
5454

55+
/*
56+
HTTP_MESSAGE_GET_METHOD(Request, getRequestTarget, request_ce, "requestTarget")
57+
*/
58+
5559
PHP_METHOD(Request, getRequestTarget)
5660
{
5761
zval rv, *obj, *value;

0 commit comments

Comments
 (0)