]> granicus.if.org Git - php/commitdiff
Use PGSQL_RETURN_OID() in more places
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 9 Sep 2020 15:09:40 +0000 (17:09 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 9 Sep 2020 15:09:40 +0000 (17:09 +0200)
ext/pgsql/pgsql.c

index ec5a6dcee2f343e67fcfeea426cf2c24ff0b5c95..57feca194e86ccf05b9063a9862dba58181c6dda 100644 (file)
@@ -1572,15 +1572,7 @@ PHP_FUNCTION(pg_field_table)
        }
 
        if (return_oid) {
-#if UINT_MAX > ZEND_LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */
-               if (oid > ZEND_LONG_MAX) {
-                       smart_str oidstr = {0};
-                       smart_str_append_unsigned(&oidstr, oid);
-                       smart_str_0(&oidstr);
-                       RETURN_NEW_STR(oidstr.s);
-               } else
-#endif
-                       RETURN_LONG((zend_long)oid);
+               PGSQL_RETURN_OID(oid);
        }
 
        /* try to lookup the table name in the resource list */
@@ -1675,17 +1667,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
                case PHP_PG_FIELD_TYPE_OID:
 
                        oid = PQftype(pgsql_result, (int)field);
-#if UINT_MAX > ZEND_LONG_MAX
-                       if (oid > ZEND_LONG_MAX) {
-                               smart_str s = {0};
-                               smart_str_append_unsigned(&s, oid);
-                               smart_str_0(&s);
-                               RETURN_NEW_STR(s.s);
-                       } else
-#endif
-                       {
-                               RETURN_LONG((zend_long)oid);
-                       }
+                       PGSQL_RETURN_OID(oid);
                        break;
                EMPTY_SWITCH_DEFAULT_CASE()
        }