Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. To: "Stefan (metze) Metzmacher" <metze@samba.org>
  2. Cc: Rusty Russell <rusty@rustcorp.com.au>,
  3. Volker Lendecke <Volker.Lendecke@SerNet.DE>,
  4. Jeremy Allison <jra@samba.org>,
  5. Samba Technical <samba-technical@lists.samba.org>
  6. Subject: Re: Talloc: pool optimizations
  7. In-Reply-To: <4D99E18D.7080708@samba.org>
  8. References: <4D94C542.5050503@samba.org>
  9. <87fwpybkjk.fsf@rustcorp.com.au>
  10. <4D99E18D.7080708@samba.org>
  11. X-Mailer: VM 8.1.0 under 23.1.1 (x86_64-pc-linux-gnu)
  12. Reply-To: tridge@samba.org
  13. FCC: ~/Mail/SMAIL.in
  14. --text follows this line--
  15. Hi Metze,
  16.  
  17. > Is it ok to push everything without TODO in the commit message?
  18.  
  19. yes, although you may wish to incorporate a few minor changes from the
  20. comments below:
  21.  
  22. - in the TC_POOL_SPACE_LEFT() macro, I think it would be clearer to
  23. use the PTR_DIFF() macro. That uses ptrdiff_t which I think is the
  24. preferred way to do pointer differencing in C
  25.  
  26. - in macros, it is generally a good idea to brace the arguments, for
  27. example in:
  28.  
  29. #define TC_POOL_FIRST_CHUNK(pool_tc) \
  30. ((void *)(TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE + (char *)pool_tc))
  31.  
  32. I think it would be better to use '(pool_tc)' on the right hand side,
  33. instead of 'pool_tc'. This avoids tricky bugs later when someone else uses
  34. the macro with an expression as an argument. (there are quite a few
  35. macros in the patches that could be improved in this way)
  36.  
  37. - the patches use void* a bit more than I would like. For example, it
  38. may be better for TC_POOLMEM_NEXT_CHUNK() to return a
  39. 'struct talloc_chunk *' rather than a void*. That would give the
  40. code more type safety, and perhaps clarity. It may make things
  41. easier to make some of the macros be static functions instead, which
  42. the compiler should inline.
  43.  
  44. - UNFINISHED COMMENTS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement