genericopenlibs/cstdlib/LCHAR/MEMCMP.C
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * FUNCTION
       
    16 * <<memcmp>>---compare two memory areas
       
    17 * INDEX
       
    18 * memcmp
       
    19 * ANSI_SYNOPSIS
       
    20 * #include <string.h>
       
    21 * int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>);
       
    22 * TRAD_SYNOPSIS
       
    23 * #include <string.h>
       
    24 * int memcmp(<[s1]>, <[s2]>, <[n]>)
       
    25 * void *<[s1]>;
       
    26 * void *<[s2]>;
       
    27 * size_t <[n]>;
       
    28 * This function compares not more than <[n]> characters of the
       
    29 * object pointed to by <[s1]> with the object pointed to by <[s2]>.
       
    30 * RETURNS
       
    31 * The function returns an integer greater than, equal to or
       
    32 * less than zero 	according to whether the object pointed to by
       
    33 * <[s1]> is greater than, equal to or less than the object
       
    34 * pointed to by <[s2]>.
       
    35 * PORTABILITY
       
    36 * <<memcmp>> is ANSI C.
       
    37 * <<memcmp>> requires no supporting OS subroutines.
       
    38 * QUICKREF
       
    39 * memcmp ansi pure
       
    40 * 
       
    41 *
       
    42 */
       
    43 
       
    44 
       
    45 
       
    46 #include <string.h>
       
    47 /**
       
    48 Compare two buffers.
       
    49 Compares the fisrt num bytes of two memory blocks pointed by m1 and m1.
       
    50 @return a value indicating the relationship between the buffers
       
    51 @param m1 Pointer to buffer. 
       
    52 @param m2 Pointer to buffer. 
       
    53 @param n  Number of bytes to compare.
       
    54 */
       
    55 
       
    56 IMPORT_C signed int memcompare(const unsigned char*, signed int, const unsigned char*, signed int);
       
    57 
       
    58 
       
    59 EXPORT_C int
       
    60 memcmp (const void* m1, const void* m2, size_t n)
       
    61 {
       
    62   return memcompare((const unsigned char*)m1, n, (const unsigned char*)m2, n); 
       
    63 }