Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103840 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98164 invoked from network); 24 Jan 2019 19:09:39 -0000 Received: from unknown (HELO mail-io1-f45.google.com) (209.85.166.45) by pb1.pair.com with SMTP; 24 Jan 2019 19:09:39 -0000 Received: by mail-io1-f45.google.com with SMTP id s8so5052071iob.13 for ; Thu, 24 Jan 2019 07:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=Kz6wo+zBRWILgtN2TRXJtST86ddlLRQIE6BHcjUeSuk=; b=vgq01mOGO/d1Y/c6ehxK5oD4cul8o35ZQPHAmuzc/02ZpIemLIUUZqcGUulXbRExRU EP6gK9GJniXLMJK7gNFaUHgTks9V9hJF1utRsnDujwksCuwz69jomuPs+RnezM0CubhR 8b9QRF7sXAJmvITb7EWFRTg9/FRMGFiikWCLTYFw5DsAS42FDAdbLkmLUST5kOgpzKdF D0N4urZOeZF/B26dRCUEOVsJwi5giGrvLQqRdgiAVingKOh3M/T6zTMTl+kZNp5sXyqG gubJSRzxZdDMGSFcFK5lJScEWJZOnUx2UGCQ8oIbXQ+60km1EHZFMhrDx964EOMqfGxM gg+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=Kz6wo+zBRWILgtN2TRXJtST86ddlLRQIE6BHcjUeSuk=; b=kQFQ0SFaEvCjUDCAVQRk8qJ+oLYUy9/p4BiEgfvzypCh/CgIJsHNSdJbijKJoq9J1t KqtMZZ3mYAKHOHfKmisUkLMKP+4UtkA582orSPCEzLUAbTwQBqYTWlVX1QS6qZMwHEJN ZWIdRqa+ffSFDsf4UM8CLNelA75uvFrHD41ZCXMjRBazhNZS4zXibBwWqJ0yBWH5Lc5G VDO19LfEHrOxh/hN6chAePlhuk0A8yrH4waP2WTvCiFE3ebROPFPOxVR5ZKXVN0CTHKp zGRKUlhpnTZTgP79nNoBKvyusE5E4oCN9G3aljhYvxsvfVRFZEcFgUwPJn6oJPEgXfkb j9yQ== X-Gm-Message-State: AHQUAua8XoXfoeTnR4MeU+3zu48QOF6iHOKqDH6paQCsGPTTjc2mZIaF gdpp4WFh/8HUaiUWsIAOoPk1RbDs/0Ji5vzlgLI= X-Google-Smtp-Source: AHgI3IawVESnWNOEGyZy1ilfaY9PDFgJc8MHSYbzQymf8nSFP6rtSPQUcVq/ygeyEdeJNoSwzsgsXTreWLPO933E1LA= X-Received: by 2002:a5d:834e:: with SMTP id q14mr4189339ior.258.1548344868791; Thu, 24 Jan 2019 07:47:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 24 Jan 2019 16:47:32 +0100 Message-ID: To: Legale Legage , PHP internals Content-Type: multipart/alternative; boundary="000000000000e4e8ce0580362121" Subject: Re: [PHP-DEV] mbstring unused internal functions From: nikita.ppv@gmail.com (Nikita Popov) --000000000000e4e8ce0580362121 Content-Type: text/plain; charset="UTF-8" On Thu, Jan 24, 2019 at 4:17 PM Legale Legage wrote: > Haven't checked php_mbregex.c > > This one is defined in mbstring.h but not exists in mbstring.c: > php_mb_check_encoding_list() > Thanks, dropped in https://github.com/php/php-src/commit/24085b187a7505aacb5bd76372f1522226656dd3 . > These are not used anywhere within php-src dir: > php_mb_mbchar_bytes() > php_mb_safe_strrchr() > The _ex versions are used though, so it probably doesn't make much sense to drop these. > I think something wrong with php_mb_mbchar_bytes_ex() > As far as i understand the function returns the character length in > bytes based on the character encoding. At least for the UTF-16, > UTF-16BE,UTF-16LE encodings it returns 1 but should return 2 or 4. > I agree that this function looks really fishy. It correctly handles UTF-8 and fixed-width encodings, but for everything else it always returns a character width of 1, which doesn't make much sense. Nikita On Thu, Jan 24, 2019, 15:45 Nikita Popov > > > On Thu, Jan 24, 2019 at 12:21 PM Legale Legage > wrote: > >> > >> Hello. > >> > >> Looking through the source code of the mbstring.c file I found a lot > >> of unused internal functions. It seems that this is just a bunch of > >> old junk. > >> > >> Examples: > >> > >> MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const > >> mbfl_encoding *enc) > >> MBSTRING_API size_t php_mb_mbchar_bytes(const char *s) > >> MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, > >> size_t nbytes) > >> MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int > >> c, size_t nbytes, const mbfl_encoding *enc) > > > > > > How did you determine that these are unused? I'm seeing uses for all of > them in mbstring.c or php_mbregex.c > > > > Nikita > --000000000000e4e8ce0580362121--