tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

strcmp.c (796B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "plstr.h"
      7 #include <string.h>
      8 
      9 PR_IMPLEMENT(PRIntn)
     10 PL_strcmp(const char* a, const char* b) {
     11  if ((const char*)0 == a) {
     12    return ((const char*)0 == b) ? 0 : -1;
     13  }
     14  if ((const char*)0 == b) {
     15    return 1;
     16  }
     17 
     18  return (PRIntn)strcmp(a, b);
     19 }
     20 
     21 PR_IMPLEMENT(PRIntn)
     22 PL_strncmp(const char* a, const char* b, PRUint32 max) {
     23  if ((const char*)0 == a) {
     24    return ((const char*)0 == b) ? 0 : -1;
     25  }
     26  if ((const char*)0 == b) {
     27    return 1;
     28  }
     29 
     30  return (PRIntn)strncmp(a, b, (size_t)max);
     31 }