[haiku-bugs] Re: [Haiku] #6256: Implement classes to successfully archive complicated object hierarchies

  • From: "yourpalal" <trac@xxxxxxxxxxxx>
  • Date: Fri, 16 Jul 2010 18:00:26 -0000

#6256: Implement classes to successfully archive complicated object hierarchies
-------------------------------+--------------------------------------------
  Reporter:  yourpalal         |         Owner:  axeld           
      Type:  enhancement       |        Status:  closed          
  Priority:  normal            |     Milestone:  R1              
 Component:  Kits/Support Kit  |       Version:  R1/Development  
Resolution:  fixed             |      Keywords:                  
Blocked By:                    |   Has a Patch:  1               
  Platform:  All               |      Blocking:  5525, 6257, 6314
-------------------------------+--------------------------------------------

Comment (by yourpalal):

 Replying to [comment:9 bonefish]:
 > Thanks! I applied the patch in r37538. I couldn't resist doing a few
 small modifications:
 >  - In the BUnarchiver class definition I indented the `enum
 ownership_policy` type to the type column and inserted a blank line before
 the constructor declaration.
 >  - I reorganized the generic BUnarchiver::InstantiateObject()
 implementation for two reasons:
 >    - While I preferred single-exit style function implementations (using
 cascaded checks or rechecks) myself several years ago (I don't recall
 whether I still used it when writing the layout code originally, but at
 least in the storage kit I did so consequently), I finally had to agree
 with others that the staggered-early-return style code is more readable,
 and to some degree even prevents programming mistakes (particularly when
 also using the RAII-style auto locker/deleter classes). So while not
 required by our coding style, I wholeheartedly recommend using it.

 Sure, I will keep that in mind!

 >    - Somewhat related to the first point actually, the code relied on
 the method's BArchivable specialization to set the object return variable
 to NULL when returning an error (`interim` is deleted). While the
 specialized implementation does that indeed, from an API design point of
 view I find it only consequent that a failing function should not be
 required to do unnecessary things like setting reference parameters to
 NULL values. I don't really mind that the implementations do, but I don't
 think the API user should rely on this behavior.

 sure, that makes sense.

 >  - I changed the first `if` condition in
 `BUnarchiveManager::GetArchivableForToken()` to `token >= fObjectCount`.
 >

 Thanks for the review & help!

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6256#comment:10>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: