Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66920 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83853 invoked from network); 3 Apr 2013 16:55:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2013 16:55:22 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.220.48 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.220.48 mail-pa0-f48.google.com Received: from [209.85.220.48] ([209.85.220.48:47929] helo=mail-pa0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 83/54-07534-9FE5C515 for ; Wed, 03 Apr 2013 11:55:21 -0500 Received: by mail-pa0-f48.google.com with SMTP id lj1so997881pab.35 for ; Wed, 03 Apr 2013 09:55:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:sender:x-originating-ip:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:x-gm-message-state; bh=AI/XS31uwfBxGS9n3ow/VVp4rlMBCAaXA4kWZ+w+N0E=; b=DQVEEw+/+MpurgguKnJ8eh3ZnXQGzsjM744bvJl/MeZd0TdKjtMRldqYWUkmYDn+Gs inyjCWXJwolshgihpHFifFOJjv461Y/d5PRwcIPat4xk1vNuqlYBQotO3ucQ+kwz0V3y 7X2209c4/DaBJmdBSqAHJrw4LVdxHt8tblw6yVEYwqmTAohIq1UF0EhJ/sV9r+rWRyS3 rOHRBxTEB4+YSM1xXHa9CuaFZt+jvipK1iBCIfIKpbQfgeKvVZsLtBRj3F9iMqFtBVFy 1Ks6skCTvjDR6TjTtGDAnw4r13NO9quK4oo4EijrnaWmc5w3RzWcs710U6x/WnwpVDQS xoXA== MIME-Version: 1.0 X-Received: by 10.68.233.74 with SMTP id tu10mr3659872pbc.57.1365008118878; Wed, 03 Apr 2013 09:55:18 -0700 (PDT) Sender: php@golemon.com Received: by 10.70.28.65 with HTTP; Wed, 3 Apr 2013 09:55:18 -0700 (PDT) X-Originating-IP: [98.210.180.187] In-Reply-To: <515BE3F6.4010304@sugarcrm.com> References: <515BE3F6.4010304@sugarcrm.com> Date: Wed, 3 Apr 2013 09:55:18 -0700 X-Google-Sender-Auth: oInKJoDSAwqEiyr-Qv_fK8lGmoQ Message-ID: To: Stas Malyshev Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQlZ+o05fNDVRHoWNlNTTBSK5t/IcoOtX8oVq/1F161ktKPHWkJwyZfayF4gy4EZVamKdu/9 Subject: Re: [PHP-DEV] [RFC] Simplified Array API for extensions From: pollita@php.net (Sara Golemon) > Nice API, I am a bit worried though about conversion routines. > Specifically, php_array_zval_to_double() uses different conversion > algorithm than PHP's standard zval to double conversion, which may > result in different results in edge cases. Also, these functions seem to > duplicate existing conversions - we already have code that converts > zvals to anything, couldn't we reuse it? BTW, it's not completely clear > what these conversion functions have to do with arrays - why they are > prefixed with php_array_*? If they aren't meant to be used directly, > maybe prefix them with __ or something? And if they are, maybe we need > better names for them... > Yeah, they're not meant to be called directly, just meant to be helpers. > In php_array_zval_to_array() the comment says "If the value is an array, > then that zval is returned, otherwise NULL is returned." but the code > says (zarr && (Z_TYPE_P(zarr))) ? zarr : NULL; which means if zarr is > anything but NULL, it would be returned, regardless if it's array or not. > That would be a typo which didn't show up in my unit test. :) > There are a lot of functions that do: > char *k = estrndup(key, key_len); > Wouldn't it be more efficient to try to use alloca if it's available? > Probably. I'll change that. > "c" functions can be a bit dangerous, since they assume the argument is > a constant supplied directly in the macro, but there's no way to catch > it if somebody does something like name="foo"; php_array_fetchc(bar, foo); > Yeah, it was a micro-optimization I threw in for the hell of it. Already convinced it doesn't belong. -Sara