You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
4.1 KiB

  1. From 7533f64b19006262fae7c6a4769392c67078166b Mon Sep 17 00:00:00 2001
  2. From: Michael Heimpold <mhei@heimpold.de>
  3. Date: Wed, 13 Jul 2016 01:07:22 +0200
  4. Subject: [PATCH 09/16] Replace zend_hash_find with zend_hash_str_find
  5. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
  6. ---
  7. dio.c | 44 ++++++++++++++++++++++----------------------
  8. 1 file changed, 22 insertions(+), 22 deletions(-)
  9. diff --git a/dio.c b/dio.c
  10. index e8660f8..b489747 100644
  11. --- a/dio.c
  12. +++ b/dio.c
  13. @@ -364,7 +364,7 @@ PHP_FUNCTION(dio_fcntl)
  14. switch (cmd) {
  15. case F_SETLK:
  16. case F_SETLKW: {
  17. - zval **element;
  18. + zval *element;
  19. struct flock lk = {0};
  20. HashTable *fh;
  21. @@ -374,28 +374,28 @@ PHP_FUNCTION(dio_fcntl)
  22. }
  23. if (Z_TYPE_P(arg) == IS_ARRAY) {
  24. fh = HASH_OF(arg);
  25. - if (zend_hash_find(fh, "start", sizeof("start"), (void **) &element) == FAILURE) {
  26. + if ((element = zend_hash_str_find(fh, "start", sizeof("start"))) == NULL) {
  27. lk.l_start = 0;
  28. } else {
  29. - lk.l_start = Z_LVAL_PP(element);
  30. + lk.l_start = Z_LVAL_P(element);
  31. }
  32. - if (zend_hash_find(fh, "length", sizeof("length"), (void **) &element) == FAILURE) {
  33. + if ((element = zend_hash_str_find(fh, "length", sizeof("length"))) == NULL) {
  34. lk.l_len = 0;
  35. } else {
  36. - lk.l_len = Z_LVAL_PP(element);
  37. + lk.l_len = Z_LVAL_P(element);
  38. }
  39. - if (zend_hash_find(fh, "whence", sizeof("whence"), (void **) &element) == FAILURE) {
  40. + if ((element = zend_hash_str_find(fh, "whence", sizeof("whence"))) == NULL) {
  41. lk.l_whence = 0;
  42. } else {
  43. - lk.l_whence = Z_LVAL_PP(element);
  44. + lk.l_whence = Z_LVAL_P(element);
  45. }
  46. - if (zend_hash_find(fh, "type", sizeof("type"), (void **) &element) == FAILURE) {
  47. + if ((element = zend_hash_str_find(fh, "type", sizeof("type"))) == NULL) {
  48. lk.l_type = 0;
  49. } else {
  50. - lk.l_type = Z_LVAL_PP(element);
  51. + lk.l_type = Z_LVAL_P(element);
  52. }
  53. } else if (Z_TYPE_P(arg) == IS_LONG) {
  54. lk.l_start = 0;
  55. @@ -463,7 +463,7 @@ PHP_FUNCTION(dio_tcsetattr)
  56. int Baud_Rate, Data_Bits=8, Stop_Bits=1, Parity=0, Flow_Control=1, Is_Canonical=1;
  57. long BAUD,DATABITS,STOPBITS,PARITYON,PARITY;
  58. HashTable *fh;
  59. - zval **element;
  60. + zval *element;
  61. if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) {
  62. return;
  63. @@ -480,40 +480,40 @@ PHP_FUNCTION(dio_tcsetattr)
  64. fh = HASH_OF(arg);
  65. - if (zend_hash_find(fh, "baud", sizeof("baud"), (void **) &element) == FAILURE) {
  66. + if ((element = zend_hash_str_find(fh, "baud", sizeof("baud"))) == NULL) {
  67. Baud_Rate = 9600;
  68. } else {
  69. - Baud_Rate = Z_LVAL_PP(element);
  70. + Baud_Rate = Z_LVAL_P(element);
  71. }
  72. - if (zend_hash_find(fh, "bits", sizeof("bits"), (void **) &element) == FAILURE) {
  73. + if ((element = zend_hash_str_find(fh, "bits", sizeof("bits"))) == NULL) {
  74. Data_Bits = 8;
  75. } else {
  76. - Data_Bits = Z_LVAL_PP(element);
  77. + Data_Bits = Z_LVAL_P(element);
  78. }
  79. - if (zend_hash_find(fh, "stop", sizeof("stop"), (void **) &element) == FAILURE) {
  80. + if ((element = zend_hash_str_find(fh, "stop", sizeof("stop"))) == NULL) {
  81. Stop_Bits = 1;
  82. } else {
  83. - Stop_Bits = Z_LVAL_PP(element);
  84. + Stop_Bits = Z_LVAL_P(element);
  85. }
  86. - if (zend_hash_find(fh, "parity", sizeof("parity"), (void **) &element) == FAILURE) {
  87. + if ((element = zend_hash_str_find(fh, "parity", sizeof("parity"))) == NULL) {
  88. Parity = 0;
  89. } else {
  90. - Parity = Z_LVAL_PP(element);
  91. + Parity = Z_LVAL_P(element);
  92. }
  93. - if (zend_hash_find(fh, "flow_control", sizeof("flow_control"), (void **) &element) == FAILURE) {
  94. + if ((element = zend_hash_str_find(fh, "flow_control", sizeof("flow_control"))) == NULL) {
  95. Flow_Control = 1;
  96. } else {
  97. - Flow_Control = Z_LVAL_PP(element);
  98. + Flow_Control = Z_LVAL_P(element);
  99. }
  100. - if (zend_hash_find(fh, "is_canonical", sizeof("is_canonical"), (void **) &element) == FAILURE) {
  101. + if ((element = zend_hash_str_find(fh, "is_canonical", sizeof("is_canonical"))) == NULL) {
  102. Is_Canonical = 0;
  103. } else {
  104. - Is_Canonical = Z_LVAL_PP(element);
  105. + Is_Canonical = Z_LVAL_P(element);
  106. }
  107. /* assign to correct values... */
  108. --
  109. 2.5.0