1. 14 12月, 2018 1 次提交
  2. 02 7月, 2018 1 次提交
  3. 14 3月, 2018 1 次提交
  4. 24 2月, 2017 15 次提交
  5. 08 9月, 2016 1 次提交
  6. 07 6月, 2016 1 次提交
  7. 23 3月, 2016 1 次提交
  8. 16 2月, 2016 1 次提交
  9. 25 9月, 2015 1 次提交
  10. 10 9月, 2015 1 次提交
  11. 09 9月, 2015 4 次提交
  12. 05 2月, 2013 1 次提交
    • E
      cutils: unsigned int parsing functions · e3f9fe2d
      Eduardo Habkost 提交于
      There are lots of duplicate parsing code using strto*() in QEMU, and
      most of that code is broken in one way or another. Even the visitors
      code have duplicate integer parsing code[1]. This introduces functions
      to help parsing unsigned int values: parse_uint() and parse_uint_full().
      
      Parsing functions for signed ints and floats will be submitted later.
      
      parse_uint_full() has all the checks made by opts_type_uint64() at
      opts-visitor.c:
      
       - Check for NULL (returns -EINVAL)
       - Check for negative numbers (returns -EINVAL)
       - Check for empty string (returns -EINVAL)
       - Check for overflow or other errno values set by strtoll() (returns
         -errno)
       - Check for end of string (reject invalid characters after number)
         (returns -EINVAL)
      
      parse_uint() does everything above except checking for the end of the
      string, so callers can continue parsing the remainder of string after
      the number.
      
      Unit tests included.
      
      [1] string-input-visitor.c:parse_int() could use the same parsing code
          used by opts-visitor.c:opts_type_int(), instead of duplicating that
          logic.
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NLaszlo Ersek <lersek@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      e3f9fe2d