Re: [Libbt-devel] restructuring
Brought to you by:
ksmathers
From: Alien <ali...@us...> - 2005-02-24 09:02:54
|
Op donderdag 24 februari 2005 05:33, schreef Elliott Mitchell: > >From: Alien <ali...@us...> > > it looks like the benc types are all in types.h and as i understand that > > most things started there, this is not how things should be: > > > > I intend to make the benc types and functions use benc instead of bt > > prefix. combined with making the bencObject_t a union instead of how it > > is now. furthermore, it has seemed to me that this allocated item that's > > in every benc type looks useless. it seems that this type should be > > filled out in one burst, to improve efficiency, (especially if frontends > > would use multithreading). of course i could be wrong, so tell me. > > Sorry for the slow commentary, my BT energy has been spent elsewhere. My > copy of the tree is also somewhat behind due to this. > > Unfortunatly a nice simple answer to the above two. NO. > > bt vs benc, look at what those structures are holding. They're holding > digested values, not raw benc data. So bt* seems more appropriate to me. > > > You clearly didn't examine how btObject is used closely enough though. > You missed that the btObject is at the top of the structure, no pointers > involved. They are allocated as a single blob. btObject has data that is > required to be present in all of them, for which constructions of this > sort make sense. > > Spend the time to look at them, and don't touch it until you understand > why it was done. Key idea, this is object-oriented programming in C. > > My tendancy is to have the type information be a pointer to a jump table > (notably the first thing being the deallocation function), rather than an > enum. The current way works though. very well, i won't touch it |