Ignore:
Timestamp:
2010-04-30T23:10:12Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0c42638, bb252ca
Parents:
bcb6f27
Message:

get rid of atoi, use str_uint64

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/kconsole.c

    rbcb6f27 r4ce914d4  
    455455                        printf("No symbol information available.\n");
    456456                        return false;
    457                 }
    458                
    459                 if (isaddr)
    460                         *result = (unative_t) symaddr;
    461                 else if (isptr)
    462                         *result = **((unative_t **) symaddr);
    463                 else
    464                         *result = *((unative_t *) symaddr);
     457                case EOK:
     458                        if (isaddr)
     459                                *result = (unative_t) symaddr;
     460                        else if (isptr)
     461                                *result = **((unative_t **) symaddr);
     462                        else
     463                                *result = *((unative_t *) symaddr);
     464                        break;
     465                default:
     466                        printf("Unknown error.\n");
     467                        return false;
     468                }
    465469        } else {
    466470                /* It's a number - convert it */
    467                 *result = atoi(text);
    468                 if (isptr)
    469                         *result = *((unative_t *) *result);
     471                uint64_t value;
     472                int rc = str_uint64(text, NULL, 0, true, &value);
     473                switch (rc) {
     474                case EINVAL:
     475                        printf("Invalid number.\n");
     476                        return false;
     477                case EOVERFLOW:
     478                        printf("Integer overflow.\n");
     479                        return false;
     480                case EOK:
     481                        *result = (unative_t) value;
     482                        if (isptr)
     483                                *result = *((unative_t *) *result);
     484                        break;
     485                default:
     486                        printf("Unknown error.\n");
     487                        return false;
     488                }
    470489        }
    471490       
Note: See TracChangeset for help on using the changeset viewer.