Staging
v0.5.1
https://github.com/python/cpython
Revision b93a52b136fd2285f2891eef91c50e3d36ea6f36 authored by Miss Islington (bot) on 14 February 2018, 00:48:28 UTC, committed by Berker Peksag on 14 February 2018, 00:48:28 UTC
This note incorrectly stated that "Base64 has an expansion factor of 6
to 4" (it is actually 4 to 3). It was decided to remove the note.

(cherry picked from commit 88c38a4049ded0e1f197fec3e76be7c0c0e83d7a)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
1 parent 5d0d0ea
Raw File
Tip revision: b93a52b136fd2285f2891eef91c50e3d36ea6f36 authored by Miss Islington (bot) on 14 February 2018, 00:48:28 UTC
bpo-27846: Delete incorrect note in base64 docs (GH-5666)
Tip revision: b93a52b
pystrcmp.c
/* Cross platform case insensitive string compare functions
 */

#include "Python.h"

int
PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
{
    if (size == 0)
        return 0;
    while ((--size > 0) &&
           (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
        if (!*s1++ || !*s2++)
            break;
    }
    return tolower((unsigned)*s1) - tolower((unsigned)*s2);
}

int
PyOS_mystricmp(const char *s1, const char *s2)
{
    while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
        ;
    }
    return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
}
back to top