Changeset 523 for trunk/boot
- Timestamp:
- Aug 30, 2018, 6:45:18 PM (6 years ago)
- Location:
- trunk/boot/tsar_mips32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/boot/tsar_mips32/boot_utils.c
r521 r523 284 284 void boot_strcpy( char * dest, const char * src) 285 285 { 286 /* Checking if the arguments are correct. */287 if ((dest == NULL) || (src == NULL))288 return;289 290 286 /* Copying the string. */ 291 287 while ((*dest++ = *src++) != '\0'); … … 297 293 { 298 294 uint32_t res = 0; /* Length of the string (in bytes). */ 299 300 if (s != NULL) 301 { 302 while (*s++ != '\0') 303 res++; 295 while (*s++ != '\0') { 296 res++; 304 297 } 305 298 306 299 return res; 307 308 300 } // boot_strlen() 309 301 … … 311 303 int boot_strcmp( const char * s1, const char * s2 ) 312 304 { 313 if ( (s1 == NULL) || (s2 == NULL))305 if (s1 == s2) 314 306 return 0; 315 307 -
trunk/boot/tsar_mips32/boot_utils.h
r521 r523 145 145 146 146 /**************************************************************************** 147 * This function copies the string pointed to by 'src' (the terminating 148 * null byte '\0' NOT included) to the buffer pointed to by 'dest'. 149 * @ src : pointer to the string to be copied .150 * @ dest : pointer to the destination string .147 * This function copies the string pointed to by 'src' (the terminating 148 * null byte '\0' NOT included) to the buffer pointed to by 'dest'. 149 * @ src : pointer to the string to be copied, should be not NULL. 150 * @ dest : pointer to the destination string, should be not NULL. 151 151 ****************************************************************************/ 152 152 void boot_strcpy( char* dest, const char * src ); … … 154 154 /**************************************************************************** 155 155 * This function calculates the length of the string pointed to by 's', 156 * excluding the terminating null byte '\0'. 157 * @ s : pointer to the string whose length is to be computed. 158 * @ returns the number of bytes in the string. 156 * excluding the terminating null byte '\0'. 157 * @ s : pointer to the string whose length is to be computed, 158 * this pointer should be not NULL. 159 * @ returns the number of bytes in the string. 159 160 ****************************************************************************/ 160 161 uint32_t boot_strlen( const char * s ); … … 162 163 /**************************************************************************** 163 164 * This function compares the 2 strings pointed to by 's1' and 's2'. 164 * @ s1 : pointer to the first string to be compared. 165 * @ s2 : pointer to the second string to be compared. 166 * @ returns 0 if these 2 strings match, 1 otherwise. 165 * If pointers point to the same adress assumed to be equals. 166 * @ s1 : pointer to the first string to be compared, should be not NULL. 167 * @ s2 : pointer to the second string to be compared, should be not NULL. 168 * @ returns 0 if these 2 strings match, 1 otherwise. 167 169 ****************************************************************************/ 168 170 int boot_strcmp( const char * s1, const char * s2 );
Note: See TracChangeset
for help on using the changeset viewer.