Changeset 28ecadb in mainline for kernel/generic/src/lib/func.c


Ignore:
Timestamp:
2006-09-22T21:44:54Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d684e4
Parents:
16529d5
Message:

Convert sparc64 to detect keyboard and determine
its physical address by walking the memory representation
of the OpenFirmware device tree.

Add bus-specific functions that know how to apply the
"ranges" property to one component of the "reg" property.
Buses supported so far include FHC, EBUS and PCI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/lib/func.c

    r16529d5 r28ecadb  
    101101 * Do a char-by-char comparison of two NULL terminated strings.
    102102 * The strings are considered equal iff they consist of the same
     103 * characters on the minimum of their lengths.
     104 *
     105 * @param src First string to compare.
     106 * @param dst Second string to compare.
     107 *
     108 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller.
     109 *
     110 */
     111int strcmp(const char *src, const char *dst)
     112{
     113        for (; *src && *dst; src++, dst++) {
     114                if (*src < *dst)
     115                        return -1;
     116                if (*src > *dst)
     117                        return 1;
     118        }
     119        if (*src == *dst)
     120                return 0;
     121        if (!*src)
     122                return -1;
     123        return 1;
     124}
     125
     126
     127/** Compare two NULL terminated strings
     128 *
     129 * Do a char-by-char comparison of two NULL terminated strings.
     130 * The strings are considered equal iff they consist of the same
    103131 * characters on the minimum of their lengths and specified maximal
    104132 * length.
     
    115143        int i;
    116144       
    117         i = 0;
    118         for (;*src && *dst && i < len;src++,dst++,i++) {
     145        for (i = 0; *src && *dst && i < len; src++, dst++, i++) {
    119146                if (*src < *dst)
    120147                        return -1;
     
    128155        return 1;
    129156}
     157
     158
    130159
    131160/** Copy NULL terminated string.
Note: See TracChangeset for help on using the changeset viewer.