1. 05 1月, 2017 1 次提交
  2. 06 12月, 2016 2 次提交
  3. 25 11月, 2016 1 次提交
    • M
      virstring: Unify string list function names · c2a5a4e7
      Michal Privoznik 提交于
      We have couple of functions that operate over NULL terminated
      lits of strings. However, our naming sucks:
      
      virStringJoin
      virStringFreeList
      virStringFreeListCount
      virStringArrayHasString
      virStringGetFirstWithPrefix
      
      We can do better:
      
      virStringListJoin
      virStringListFree
      virStringListFreeCount
      virStringListHasString
      virStringListGetFirstWithPrefix
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c2a5a4e7
  4. 08 6月, 2016 1 次提交
  5. 27 5月, 2016 1 次提交
    • E
      maint: update to latest gnulib · 0cd64883
      Eric Blake 提交于
      Pulls in several portability fixes, including the fact that gnulib
      now only works on platforms with two's complement signed integers.
      Also makes for a smaller delta on the next update (we are waiting
      on a license change to unsetenv for the sake of mingw).
      
      * .gnulib: Update to latest.
      * bootstrap: Resync from upstream.
      * tests/virstringtest.c: Drop use of obsolete probes of integer
      properties.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0cd64883
  6. 10 2月, 2016 1 次提交
  7. 16 4月, 2015 2 次提交
  8. 30 10月, 2014 1 次提交
  9. 15 10月, 2014 1 次提交
  10. 11 9月, 2014 1 次提交
  11. 24 6月, 2014 1 次提交
  12. 03 6月, 2014 1 次提交
    • P
      util: string: Return element count from virStringSplit · 68226749
      Peter Krempa 提交于
      To allow using the array manipulation macros on the arrays returned by
      virStringSplit we need to know the count of the elements in the array.
      Modify virStringSplit to return this value, rename it and add a helper
      with the old name so that we don't need to update all the code.
      68226749
  13. 31 5月, 2014 1 次提交
    • E
      build: avoid compiler warning on 32-bit platform · c7ca02e6
      Eric Blake 提交于
      On a 32-bit platform:
      
      virstringtest.c: In function 'mymain':
      virstringtest.c:673: warning: this decimal constant is unsigned only in ISO C90
      
      I already had a comment in the file about the 64-bit counterpart;
      the easiest fix was to make both sites use the standardized macro
      that is guaranteed to work.
      
      * tests/virstringtest.c (mymain): Minimum signed integers are a pain.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c7ca02e6
  14. 02 5月, 2014 2 次提交
    • E
      util: new stricter unsigned int parsing · 7b045c8c
      Eric Blake 提交于
      strtoul() is required to parse negative numbers as their
      twos-complement positive counterpart.  But sometimes we want
      to reject negative numbers.  Add new functions to do this.
      The 'p' suffix is a mnemonic for 'positive' (technically it
      also parses 0, but 'non-negative' doesn't lend itself to a
      nice one-letter suffix).
      
      * src/util/virstring.h (virStrToLong_uip, virStrToLong_ulp)
      (virStrToLong_ullp): New prototypes.
      * src/util/virstring.c (virStrToLong_uip, virStrToLong_ulp)
      (virStrToLong_ullp): New functions.
      * src/libvirt_private.syms (virstring.h): Export them.
      * tests/virstringtest.c (testStringToLong): Test them.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7b045c8c
    • E
      util: fix uint parsing on 64-bit platforms · f18c02ec
      Eric Blake 提交于
      Commit f22b7899 called to light a long-standing latent bug: the
      behavior of virStrToLong_ui was different on 32-bit platforms
      than on 64-bit platforms.  Curse you, C type promotion and
      narrowing rules, and strtoul specification.  POSIX says that for
      a 32-bit long, strtol handles only 2^32 values [LONG_MIN to
      LONG_MAX] while strtoul handles 2^33 - 1 values [-ULONG_MAX to
      ULONG_MAX] with twos-complement wraparound for negatives.  Thus,
      parsing -1 as unsigned long produces ULONG_MAX, rather than a
      range error.  We WANT[1] this same shortcut for turning -1 into
      UINT_MAX when parsing to int; and get it for free with 32-bit
      long.  But with 64-bit long, ULONG_MAX is outside the range
      of int and we were rejecting it as invalid; meanwhile, we were
      silently treating -18446744073709551615 as 1 even though it
      textually exceeds INT_MIN.  Too bad there's not a strtoui() in
      libc that does guaranteed parsing to int, regardless of the size
      of long.
      
      The bug has been latent since 2007, introduced by Jim Meyering
      in commit 5d254191 in the attempt to eradicate unsafe use of
      strto[u]l when parsing ints and longs.  How embarrassing that we
      are only discovering it now - so I'm adding a testsuite to ensure
      that it covers all the corner cases we care about.
      
      [1] Ideally, we really want the caller to be able to choose whether
      to allow negative numbers to wrap around to their 2s-complement
      counterpart, as in strtoul, or to force a stricter input range
      of [0 to UINT_MAX] by rejecting negative signs; this will be added
      in a later patch for all three int types.
      
      This patch is tested on both 32- and 64-bit; the enhanced
      virstringtest passes on both platforms, while virstoragetest now
      reliably fails on both platforms instead of just 32-bit platforms.
      That test will be fixed later.
      
      * src/util/virstring.c (virStrToLong_ui): Ensure same behavior
      regardless of platform long size.
      * tests/virstringtest.c (testStringToLong): New function.
      (mymain): Comprehensively test string to long parsing.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f18c02ec
  15. 25 3月, 2014 1 次提交
  16. 18 3月, 2014 2 次提交
  17. 24 2月, 2014 2 次提交
  18. 28 11月, 2013 1 次提交
  19. 08 10月, 2013 1 次提交
  20. 01 6月, 2013 1 次提交
  21. 24 5月, 2013 1 次提交
    • M
      virStrndup: Accept negative values as string length · c9357196
      Michal Privoznik 提交于
      It may shorten the code a bit as the following pattern:
      
        VIR_STRNDUP(dst, src, cond ? n : strlen(src))
      
      is used on several places among our code. However, we can
      move the strlen into virStrndup and thus write just:
      
        VIR_STRNDUP(dst, src, cond ? n : -1)
      c9357196
  22. 16 5月, 2013 1 次提交
  23. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  24. 21 12月, 2012 4 次提交
  25. 01 12月, 2012 1 次提交