Changeset 28ecadb in mainline for boot/generic/string.c


Ignore:
Timestamp:
2006-09-22T21:44:54Z (19 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
  • boot/generic/string.c

    r16529d5 r28ecadb  
    5858 * Do a char-by-char comparison of two NULL terminated strings.
    5959 * The strings are considered equal iff they consist of the same
     60 * characters on the minimum of their lengths.
     61 *
     62 * @param src First string to compare.
     63 * @param dst Second string to compare.
     64 *
     65 * @return 0 if the strings are equal, -1 if first is smaller, 1 if second smaller.
     66 *
     67 */
     68int strcmp(const char *src, const char *dst)
     69{
     70        for (; *src && *dst; src++, dst++) {
     71                if (*src < *dst)
     72                        return -1;
     73                if (*src > *dst)
     74                        return 1;
     75        }
     76        if (*src == *dst)
     77                return 0;
     78        if (!*src)
     79                return -1;
     80        return 1;
     81}
     82
     83
     84/** Compare two NULL terminated strings
     85 *
     86 * Do a char-by-char comparison of two NULL terminated strings.
     87 * The strings are considered equal iff they consist of the same
    6088 * characters on the minimum of their lengths and specified maximal
    6189 * length.
     
    72100        int i;
    73101       
    74         i = 0;
    75         for (;*src && *dst && i < len;src++,dst++,i++) {
     102        for (i = 0; *src && *dst && i < len; src++, dst++, i++) {
    76103                if (*src < *dst)
    77104                        return -1;
Note: See TracChangeset for help on using the changeset viewer.