1. 25 Jan, 2009 4 commits
  2. 24 Jan, 2009 1 commit
  3. 17 Jan, 2009 1 commit
  4. 14 Jan, 2009 1 commit
  5. 13 Jan, 2009 1 commit
  6. 04 Jan, 2009 2 commits
  7. 03 Jan, 2009 3 commits
  8. 28 Dec, 2008 1 commit
  9. 03 Nov, 2008 1 commit
  10. 01 Nov, 2008 3 commits
  11. 31 Oct, 2008 1 commit
  12. 08 Oct, 2008 1 commit
  13. 06 Oct, 2008 1 commit
  14. 29 Sep, 2008 1 commit
    • Eric Wong's avatar
      Switch to C99 types (retaining compat with old compilers) · 0352766d
      Eric Wong authored
      Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the
      mind needs to retrain itself to skip over the first 4 tokens of
      a type to get to its meaning.  So avoid having extra characters
      on my terminal to make it easier to follow code at 2:30 am in
      the morning.
      
      Please report any new issues you may come across on Free
      toolchains.  I realize how difficult it can be to build/maintain
      cross-compiling toolchains and I have no intention of forcing
      people to upgrade their toolchains to build mpd.
      
      Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
      0352766d
  15. 08 Sep, 2008 1 commit
    • Max Kellermann's avatar
      use strset.h instead of tagTracker.h · f0e64ceb
      Max Kellermann authored
      With a large music database, the linear string collection in
      tagTracker.c becomes very slow.  We implemented that in a
      quick'n'dirty fashion when we removed tree.c, and now we rewrite it
      using the fast hashed string set.
      f0e64ceb
  16. 07 Sep, 2008 4 commits
    • Eric Wong's avatar
      tag: oops, of course items is now ** and not * · a5f68b3c
      Eric Wong authored
      Gah, it seems like doing sizeof here either way is error
      prone.  Too easy to leave out a '*' character we can
      forget.
      a5f68b3c
    • Eric Wong's avatar
      tag: lock all accesses to tag_pool · 3c4de5b5
      Eric Wong authored
      The tag pool is a shared global resource that is infrequently
      modified.  However, it can occasionally be modified by several
      threads, especially by the metadata_pipe for streaming metadata
      (both reading/writing).
      
      The bulk tag_item pool is NOT locked as currently only the
      update thread uses it.
      3c4de5b5
    • Eric Wong's avatar
      tag: introduce handy items_size() function · 194c8c3c
      Eric Wong authored
      Trying to read or remember
        "tag->numOfItems * sizeof(*tag->items)"
      requires too much thinking and mental effort on my part.
      
      Also, favor "sizeof(struct mpd_tag)" over "sizeof(*tag->items)"
      because the former is easier to read and follow, even though
      the latter is easier to modify if the items member changes
      to a different type.
      194c8c3c
    • Max Kellermann's avatar
      tag: moved code to tag_print.c · 386c3031
      Max Kellermann authored
      Move everything which dumps a tag to a file descriptor to tag_print.c.
      This relaxes dependencies and splits the code into smaller parts.
      386c3031
  17. 06 Sep, 2008 1 commit
    • Eric Wong's avatar
      tag: fix segfault on update · 092bdf3d
      Eric Wong authored
      clearMpdTag could be called on a tag that was still in a
      tag_begin_add transaction before tag_end_add is called.  This
      was causing free() to attempt to operate on bulk.items; which is
      un-free()-able.  Now instead we unmark the bulk.busy to avoid
      committing the tags to the heap only to be immediately freed.
      
      Additionally, we need to remember to call tag_end_add() when
      a song is updated before we NULL song->tag to avoid tripping
      an assertion the next time tag_begin_add() is called.
      092bdf3d
  18. 29 Aug, 2008 12 commits
    • Max Kellermann's avatar
      tag: optimize tag_dup(), copy item references · d38d2bc3
      Max Kellermann authored
      Don't call tag_pool_get_item() for duplicating tags, just increase the
      item's reference counter instead.
      d38d2bc3
    • Max Kellermann's avatar
      const pointers · 37d77caa
      Max Kellermann authored
      Yet another patch which converts pointer arguments to "const".
      37d77caa
    • Max Kellermann's avatar
      tag: try not to reallocate tag.items in every add() call · 1aa34573
      Max Kellermann authored
      If many tag_items are added at once while the tag cache is being
      loaded, manage these items in a static fixed list, instead of
      reallocating the list with every newly created item.  This reduces
      heap fragmentation.
      
      Massif results again:
      
       mk before:  total 12,837,632; useful 10,626,383; extra 2,211,249
       mk now:     total 12,736,720; useful 10,626,383; extra 2,110,337
      
      The "useful" value is the same since this patch only changes the way
      we allocate the same amount of memory, but heap fragmentation was
      reduced by 5%.
      1aa34573
    • Max Kellermann's avatar
      tag: try not to duplicate the input string · a208d654
      Max Kellermann authored
      Try to detect if the string needs Latin1-UTF8 conversion, or
      whitespace cleanup.  If not, we don't need to allocate temporary
      memory, leading to decreased heap fragmentation.
      a208d654
    • Max Kellermann's avatar
      tag: pass length to fix_utf8() · 9352fc9e
      Max Kellermann authored
      Same as the previous patch, prepare the function fix_utf8() this time.
      9352fc9e
    • Max Kellermann's avatar
      added "length" parameter to validUtf8String() · 43c389b9
      Max Kellermann authored
      At several places, we create temporary copies of non-null-terminated
      strings, just to use them in functions like validUtf8String().  We can
      save this temporary allocation and avoid heap fragmentation if we
      add a length parameter instead of expecting a null-terminated string.
      43c389b9
    • Max Kellermann's avatar
      assert value!=NULL in fix_utf8() · 92b75767
      Max Kellermann authored
      We must never pass value==NULL to fix_utf().  Replace the run-time
      check with an assertion.
      92b75767
    • Max Kellermann's avatar
      tag: converted macro fixUtf8() to an inline function · f99fe808
      Max Kellermann authored
      Since the inline function cannot modify its caller's variables (which
      is a good thing for code readability), the new string pointer is the
      return value.  The resulting binary should be the same as with the
      macro.
      f99fe808
    • Max Kellermann's avatar
      tag: added a pool for tag items · c855415c
      Max Kellermann authored
      The new source tag_pool.c manages a pool of reference counted tag_item
      objects.  This is used to merge tag items of the same type and value,
      saving lots of memory.  Formerly, only the value itself was pooled,
      wasting memory for all the pointers and tag_item structs.
      
      The following results were measured with massif.  Started MPD on
      amd64, typed "mpc", no song being played.  My music database contains
      35k tagged songs.  The results are what massif reports as "peak".
      
       0.13.2:     total 14,131,392; useful 11,408,972; extra 2,722,420
       eric:       total 18,370,696; useful 15,648,182; extra 2,722,514
       mk f34f694e: total 15,833,952; useful 13,111,470; extra 2,722,482
       mk now:     total 12,837,632; useful 10,626,383; extra 2,211,249
      
      This patch set saves 20% memory, and does a good job in reducing heap
      fragmentation.
      c855415c
    • Max Kellermann's avatar
      tag: converted tag_item.value to a char array · e5a78798
      Max Kellermann authored
      The value is stored in the same memory allocation as the tag_item
      struct; this saves memory because we do not store the value pointer
      anymore.  Also remove the getTagItemString()/removeTagItemString()
      dummies.
      e5a78798
    • Max Kellermann's avatar
      tag: converted MpdTag.items to a pointer list · ad0e09b2
      Max Kellermann authored
      This prepares the following patches, which aim to reduce MPD's memory
      usage: we plan to share tag_item instances, instead of just their
      values.
      ad0e09b2
    • Max Kellermann's avatar
      tag: moved code to tag_id3.c · 6f72fe3e
      Max Kellermann authored
      The ID3 code uses only the public tag API, but is otherwise
      unrelated.  Move it to a separate source file.
      6f72fe3e