1/* -*- buffer-read-only: t -*- vi: set ro: */ 2/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 3#line 1 4/* Compare two memory areas with possibly different lengths. 5 Copyright (C) 2009, 2010 Free Software Foundation, Inc. 6 7 This program is free software: you can redistribute it and/or modify it 8 under the terms of the GNU General Public License as published 9 by the Free Software Foundation; either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20#include <config.h> 21 22/* Specification. */ 23#include "memcmp2.h" 24 25#include <string.h> 26 27int 28memcmp2 (const char *s1, size_t n1, const char *s2, size_t n2) 29{ 30 int cmp = memcmp (s1, s2, n1 <= n2 ? n1 : n2); 31 if (cmp == 0) 32 { 33 if (n1 < n2) 34 cmp = -1; 35 else if (n1 > n2) 36 cmp = 1; 37 } 38 return cmp; 39} 40