2008-07-07T07:56:44 *** kgs_away has joined #openils-evergreen 2008-07-07T07:56:53 *** kgs_away is now known as kgs_run 2008-07-07T07:57:16 *** kgs_run is now known as kgs 2008-07-07T08:14:06 *** Slazer has joined #openils-evergreen 2008-07-07T08:18:57 *** kbeswick has joined #openils-evergreen 2008-07-07T08:20:26 *** Slazer has quit IRC 2008-07-07T08:29:07 *** Slazer has joined #openils-evergreen 2008-07-07T08:43:59 *** dbs has quit IRC 2008-07-07T08:49:25 *** dbs has joined #openils-evergreen 2008-07-07T08:54:32 huh. we've committed >1000 changes to ILS trunk since hallowe'en 2007, if the svn log does not lie 2008-07-07T08:57:34 almost at 10000 2008-07-07T08:58:22 kbeswick: yeah, that's for all branches (rel_1_2, rel_1_2_2, acq-experiment) 2008-07-07T08:58:52 if it wasn't for miker_'s damned commit yesterday, I would have a streak of about a dozen consecutive commits going 2008-07-07T08:59:07 dbs++ #commit master 2008-07-07T08:59:17 * dbs can think of all kinds of fun pinesol plugins looking at commit stats 2008-07-07T09:00:45 Slazer: did you feel a great weight come off your shoulders when you saw that the rest of your patches had been committed? 2008-07-07T09:04:17 I think I'm going to send off an updated batch of POT files to our Armenian translation volunteer for an early evaluation of how horrible things look 2008-07-07T09:05:56 dbs: sorry, didn't hear that you were talking to me but yes. I did. That was a bit scary. Heh, wasn't sure if I screwed something up horribly or not... but from what I can see things are looking/working fine. 2008-07-07T09:06:43 nope, working well; there were only a few minor problems that I figured would be easier to simply fix & commit in my local tree 2008-07-07T09:06:48 Good job! 2008-07-07T09:07:24 Thanks. =) 2008-07-07T09:08:08 I still need to eyeball the files to see if a few more hardcoded strings snuck past - I caught a few of those - but we're so close to the finish line I can taste it 2008-07-07T09:08:30 Are you going to tackle the Evergreen/xul/staff_client/server/patron/* files today? 2008-07-07T09:10:34 dbs: you said that there was a chance I'd have to modify the httpd.conf file to allow apache to use mod_xmlent to process .xml files as well... the only httpd.conf file I found on my system to try and test it out only loaded the xmlent module plus one other module for json. 2008-07-07T09:10:49 So if that is the file I have to modify, what do I have to put in it? 2008-07-07T09:10:58 s/httpd.conf/eg.conf 2008-07-07T09:11:05 Ahhhh. 2008-07-07T09:11:07 or eg_vhost.conf, can't remember which 2008-07-07T09:11:11 sorry :( 2008-07-07T09:11:16 I'll look. =) 2008-07-07T09:12:20 in eg_vhost.conf: 2008-07-07T09:12:55 provides a template for what you're looking at trying to do; earlier, XMLENT is turned on for .xml files in /opac/ 2008-07-07T09:14:00 what file was this for, anyways? Open-ILS/xul/staff_client/server/patron/user_edit.xml ? 2008-07-07T09:14:27 Yes 2008-07-07T09:15:03 I'm not convinced anything actually uses that 2008-07-07T09:15:21 I haven't been able to find it in the staff client... but... *shrug* 2008-07-07T09:15:24 it might be a dead file that we can just delete 2008-07-07T09:15:29 I don't know my way aroudn it. 2008-07-07T09:15:32 phasefx? 2008-07-07T09:15:32 aound* 2008-07-07T09:15:39 around* -_- 2008-07-07T09:15:39 So ignore it for now 2008-07-07T09:15:45 Alllrighty then. 2008-07-07T09:16:06 So I'll go do the Evergreen/..../patron folder then. 2008-07-07T09:16:56 other than that xml file there is the xhtml file while I'm still not really sure on how to convert over to a xul type file. 2008-07-07T09:17:41 I'll drop by post-change of biking clothes and we can chat some more 2008-07-07T09:17:50 maybe gossip about the neighbours 2008-07-07T09:17:57 Heh, deal. 2008-07-07T09:18:48 phasefx phasefx_ phasefx2: your wisdom regarding the use (or disposal of) patron/user_edit.xml would be greatly appreciated 2008-07-07T09:23:30 dbs: I'm about to transit myself to the office, so back in an hour. That's berick/miker's file; would it make things easier to rename it to .xhtml? 2008-07-07T09:24:03 phasefx_: perhaps, if it actually is used - we can talk later 2008-07-07T09:24:09 user_edit.xhtml? is that the user permission editor? 2008-07-07T09:24:51 user_edit.xml - and yeah, now I see the constants being declared for it 2008-07-07T09:25:02 cross-reference constants.js.. XUL_USER_PERM_EDITOR 2008-07-07T09:25:06 Open-ILS/xul/staff_client/build/server/main/constants.js: 'XUL_USER_PERM_EDITOR' : '/xul/20080703.175905/server/patron/user_edit.xml' 2008-07-07T09:26:17 renaming it to .xhtml would probably be easiest, as a matter of fact 2008-07-07T09:26:47 can do, will do 2008-07-07T09:29:07 done 2008-07-07T09:30:09 there ya go, Slazer, you can go nuts on that now too 2008-07-07T09:30:21 phasefx_: will there be any local changes to the SC in 1.2.2.2 requiring (or suggesting) a new local install? 2008-07-07T09:30:36 Will do. 2008-07-07T09:31:09 *** rsinger has joined #OpenILS-Evergreen 2008-07-07T10:25:00 *** gmcharlt has joined #OpenILS-Evergreen 2008-07-07T10:45:25 dmcmorris_esi: there are indeed some local fixes for the staff client 2008-07-07T10:46:58 phasefx: ok, thanks 2008-07-07T11:02:56 dbs: thanks for the 8.1 change in trunk :) 2008-07-07T11:03:19 miker_: I forgot to add "(grrrr)" to the commit message 2008-07-07T11:03:22 :) 2008-07-07T11:04:06 ha 2008-07-07T11:06:35 dbs: i have successfully made a .tar.gz with 'make dist' 2008-07-07T11:06:54 im assuming that it won't have all the required files though. im checking now. 2008-07-07T11:07:49 haha nope- make distcheck fails. 2008-07-07T11:08:24 check your MANIFEST for out-of-dateness 2008-07-07T11:09:31 (assuming Perl with EU::MM or Module::Install) 2008-07-07T11:10:15 kbeswick: cool 2008-07-07T11:11:13 sboyette: sayyyyyy.... do you have experience with EU::MM or Module::Install that you would like to contribute? 2008-07-07T11:12:19 i don't know precisely what issue is being discussed, but i'm game 2008-07-07T11:12:25 fair warning: i'm running on 1.5 hours of sleep 2008-07-07T11:12:29 right now the Perl module install process is the equivalent of "cp -r Perlmods $(PREFIX)/lib/perl5; export PERL5LIB=$(PREFIX)/lib/perl5:$PERL5LIB" 2008-07-07T11:14:14 well, if the modules are laid out in a CPAN-normative way, laying M::I down on top of them should be cake 2008-07-07T11:14:38 (if they're NOT, my first instinct would be to make them so, but nobody likes That Guy) 2008-07-07T11:15:48 also, if ExtUtils isn't currently being used, i wouldn't start now. there are a couple of alternatives. the one i like is obvious by now 2008-07-07T11:16:27 (EU::MM isn't officially deprecated, but it's so old and crufty and everyone agrees it's time to start leading it out to pasture) 2008-07-07T11:19:08 sboyette: fwiw, I've been eyeballing M::I for its happyfuntime embededness 2008-07-07T11:20:08 yeah, that seems like a nice bonus. i'm using it on Curses::UI and my language project just because it's so much nicer :) 2008-07-07T11:21:09 Alias is going kinda nuts with the self-sufficient perls these days. he's currently working on a TPF grant to create "Perl On A Stick", a full Windows perl development environment on a USB key. 2008-07-07T11:21:31 i <3 that crazy Australian, even though i eeevil: I suppose you could direct kbeswick to learn about M:I 2008-07-07T11:25:53 I certainly could :) 2008-07-07T11:26:13 dbs eeevi: would it be a problem that i haven't done anything in perl before? 2008-07-07T11:26:32 s/eeevi/eeevil/ 2008-07-07T11:27:18 i'll be available for heavy-duty helping in roughly a month. until then i'm kinda slammed :) 2008-07-07T11:29:08 kbeswick: does this look too scary? http://search.cpan.org/dist/Module-Install/lib/Module/Install.pod 2008-07-07T11:29:37 dbs: not at all. 2008-07-07T11:29:38 kbeswick: you needs to learn Perl sometime 2008-07-07T11:30:25 it's a question of whether we need a real Perl module installer or basic autotools for Evergreen 2008-07-07T11:30:31 (first) 2008-07-07T11:32:05 sboyette: wow. if you could help out in a month's time, that would be awesome 2008-07-07T11:33:22 kbeswick: note that you currently don't have to worry about test_requires :P 2008-07-07T11:36:35 dbs: sir boyette will be absorbed into the equiborg on Aug4 :) 2008-07-07T11:37:10 huzzah 2008-07-07T11:38:42 yep. i'll be an Equinoxen, yay! 2008-07-07T11:38:55 then i have to do whatever they say. no more free will. 2008-07-07T11:39:11 heh 2008-07-07T11:39:18 hey, I'm the only oxen here 2008-07-07T11:43:16 mooooo 2008-07-07T11:43:26 * dbs tries to hold the fort, with Slazer, for non-Equinoxian contributors 2008-07-07T11:44:04 i've actually never been a contributor, though i was an early irritant 2008-07-07T11:44:39 i just worked on a lot of... programmatically-nearby things. 2008-07-07T11:45:33 sboyette: you were our first external irritant, actually 2008-07-07T11:47:13 \o/ 2008-07-07T11:50:04 http://open-ils.org/blog/?p=17#comment-95 2008-07-07T11:50:30 oh man 2008-07-07T11:50:32 * sboyette winces 2008-07-07T11:54:17 hah - for what it's worth, I'm in spiritual solidarity with you for font stuff :) 2008-07-07T11:55:23 -= THIS MESSAGE NOT LOGGED =- 2008-07-07T12:05:24 Ahh! So sboyette is going to build the Curses UI! (http://search.cpan.org/~mdxi/Curses-UI-0.9605/) 2008-07-07T12:05:36 hehehe 2008-07-07T12:06:42 everybody keeps spoiling my April Fool's joke :( 2008-07-07T12:06:48 now i have to think of something else 2008-07-07T12:08:06 sboyette: do it do it. Just say you want to do it as a way of learning Evergreen API 2008-07-07T12:08:37 it's still quite tempting 2008-07-07T12:08:57 i own a Wyse60, you know :) 2008-07-07T12:08:58 hello Evergreen RS232 2008-07-07T12:10:05 It could be one of the value-adds of the Equinox Evergreen distribution - available only to Equinox customers, a state of the art terminal UI 2008-07-07T12:10:17 someone somewhere will write an expect script for it and start screen scraping 2008-07-07T12:10:48 lynx, elinks, or perhaps just an aalib xserver? ;) 2008-07-07T12:11:04 it could, but we should share the love 2008-07-07T12:11:32 I've been tempted to see what the current client would look like with aalib and X 2008-07-07T12:11:59 could distribute that as a vmware image :D 2008-07-07T12:12:49 heh 2008-07-07T12:14:18 * dmcmorris_esi looks at the Tandy TRS-80 DT-100 dumb terminal that is streaming IRC for me.... 2008-07-07T12:15:32 \m/. 2008-07-07T12:38:46 http://picasaweb.google.com/dmcmorris.esi/Junk/photo#5220311140134554626 2008-07-07T15:04:49 *** Slazer has quit IRC 2008-07-07T17:10:00 *** kgs is now known as kgs_away 2008-07-07T17:11:10 I've been meaning to ask, what is sentence case in the context of cataloging? 2008-07-07T17:12:28 got it 2008-07-07T17:18:19 dbs: kbeswick is opensrf buildable and runnable now? what do i need to make it "work like before"? --prefix=/openils .. what else? 2008-07-07T17:18:33 --sysconfdir=/openils/conf i guesss 2008-07-07T17:19:01 berick: that's just about right 2008-07-07T17:19:58 i think the osrf_math and osrf_dbmath.so are named libosrf_math and libosrf_dbmath now (it's a heavy expectation of libtool that output lib names be lib*) 2008-07-07T17:20:06 but you wouldn't care about that for openils 2008-07-07T17:21:07 yeah 2008-07-07T17:21:10 thanks 2008-07-07T17:21:14 i'll give it a whirl 2008-07-07T17:21:30 I think there's still one oddity with respect to legacy json 2008-07-07T17:21:59 essentially: I think you're going to need to -lobjson -lopensrf 2008-07-07T17:22:28 (but just for oils_dataloader.so if my centos experiment is correct) 2008-07-07T17:23:29 ok 2008-07-07T17:23:46 baby steps at this point.. just running opensrf.settings to test the translator 2008-07-07T17:23:49 berick: might be a good time to turn on trac so I can start assigning tickets to kbeswick before I forget everything :) 2008-07-07T17:24:03 ooh yeah, the C translator was remarkably small 2008-07-07T17:24:20 dbs: sure! i wasn't sure if we had decided to go forth with that 2008-07-07T17:24:23 i'm ready, though 2008-07-07T17:24:40 berick: yeah, we had audible head nods all around 2008-07-07T17:24:43 dbs: yeah, it doesn't do very much, fortunately 2008-07-07T17:24:48 ok, good 2008-07-07T17:24:53 justa sec.. 2008-07-07T17:24:53 along with some email confirmation from the eeevil one 2008-07-07T17:25:23 "better than bugzilla" I think he said... 2008-07-07T17:25:34 hah 2008-07-07T17:30:57 okay, heading home 2008-07-07T17:31:01 lat-ah 2008-07-07T17:31:03 *** dbs has quit IRC 2008-07-07T17:31:13 * berick emails dbs 2008-07-07T17:33:57 *** kbeswick has quit IRC 2008-07-07T19:33:29 arg, i think scott's json object re-use-pool code is busted 2008-07-07T19:33:49 making what appears to be invalid use of unions 2008-07-07T19:38:23 * berick emails 2008-07-07T19:52:17 *** miker__ has joined #openils-evergreen 2008-07-07T19:52:39 *** miker_ has quit IRC 2008-07-07T19:52:44 *** miker__ is now known as miker_ 2008-07-07T20:02:57 *** sarabee_ has quit IRC 2008-07-07T20:04:58 *** sarabee has joined #openils-evergreen 2008-07-07T20:05:22 *** sarabee has quit IRC 2008-07-07T20:12:51 *** sarabee has joined #openils-evergreen 2008-07-07T20:16:18 *** djfiander has joined #OpenILS-Evergreen 2008-07-07T20:17:35 berick? 2008-07-07T20:18:34 for some requests, I'm getting back the response 2008-07-07T20:18:37 http://paste.lisp.org/display/63249 2008-07-07T20:20:24 djfiander: wow :) 2008-07-07T20:20:41 I don't know that I've seen that in the wild in ... about 3.5 years :) 2008-07-07T20:22:34 lucky me 2008-07-07T20:26:12 so, what can be done about it? I'm kinda stuck without a working server, eh 2008-07-07T20:26:42 sec 2008-07-07T20:28:32 try it again? 2008-07-07T20:28:43 restarted services and apache on acq 2008-07-07T20:28:58 ok, that fixed it 2008-07-07T20:30:51 good 2008-07-07T20:47:37 *** dbs has joined #openils-evergreen 2008-07-07T20:49:22 kids these days. can't even overlay datastructures in C anymore. 2008-07-07T20:52:39 heh 2008-07-07T20:52:57 berick: you here? 2008-07-07T20:53:49 heh 2008-07-07T20:53:51 "warning: Source file is more recent than executable." 2008-07-07T20:53:59 somebody should take care of that. 2008-07-07T20:54:13 there must be something freeing the object outside of the freelist stuff, because that's in very heavy use right now inside cstore 2008-07-07T20:54:15 gdb++ 2008-07-07T20:55:14 miker_: that shouldn't be a problem. If I get something from the freeobj list and then free() it, it'll just go back onto the heap and disappear 2008-07-07T20:55:48 unless there's more code that I haven't seen in the list-management stuff 2008-07-07T20:59:05 well, everything in list management is handed off to the list management code ... when you call osrfObjectFree or whatever it doesn't actually free the memory, it just tosses it on the pile for reuse 2008-07-07T21:00:30 and osrfObjectNew or whatever it's called tries to grab a blob from the head of the freeObjList before doing a malloc dance 2008-07-07T21:01:19 of course. 2008-07-07T21:01:35 now, does it malloc one, or does it malloc an array and then set up links within the array? 2008-07-07T21:01:58 if the latter, then calling free() on a jsonObject would be... bad. 2008-07-07T21:07:32 I'll check 2008-07-07T21:09:50 arg ... baby troubles 2008-07-07T21:09:58 brb 2008-07-07T21:10:09 don't you hate when that happens 2008-07-07T21:10:11 ;) 2008-07-07T21:19:48 djfiander: the code in question is at http://svn.open-ils.org/trac/OpenSRF/browser/trunk/src/libopensrf/osrf_json_object.c if you're interested in digging deeper 2008-07-07T21:24:48 that code all looks good. 2008-07-07T21:42:50 that code all looks bad to me :( 2008-07-07T21:43:19 trust me. it's good. a caller is buggering something up. 2008-07-07T21:43:31 the unusedObUniion stuff, that is 2008-07-07T21:43:34 the union stuff? 2008-07-07T21:43:37 yes. 2008-07-07T21:44:08 this is not good: 2008-07-07T21:44:10 190 unusedObj* unused = (unusedObj*) o; 2008-07-07T21:44:11 191 unused->next = freeObjList; 2008-07-07T21:44:37 nope, that's perfect. 2008-07-07T21:44:48 you're adding 'o' to the front of the list of free objects. 2008-07-07T21:45:03 and free objects don't have json data in them. 2008-07-07T21:45:24 if they don't have json data in them, why keep them? 2008-07-07T21:45:46 because it's easier to pull an empty object off the list than to call malloc again. 2008-07-07T21:46:06 but an empty object is json data .. i mean, it's a jsonObject 2008-07-07T21:46:17 so it does occupy space 2008-07-07T21:46:30 OMG. berick, trust me. the code is all good. 2008-07-07T21:46:35 that conflicts with the space occupied by the 'next' pointer in the usion 2008-07-07T21:46:42 no, it doesn't. 2008-07-07T21:46:48 no, i won't trust you until it's fully explained :) 2008-07-07T21:47:41 after you call jsonObjectFree, the chunk of memory that was a json object is just a json-object-sized blob of memory that's held on a linked list of similar blobs 2008-07-07T21:48:31 ok 2008-07-07T21:49:26 ok, let me start over. 2008-07-07T21:49:52 yes. you could use a struct. it would use more memory, but it would be fine. 2008-07-07T21:50:09 here's the basic idea: 2008-07-07T21:50:50 when jsonNewObject is called, it checks to see if we have a spare json object lying around. If we do, we take it off the list of spare objects and return it. 2008-07-07T21:51:21 djfiander: quick interruption.. 2008-07-07T21:51:35 when jsonObjectFree is called, it puts the object back on the list of spares. 2008-07-07T21:51:38 yes 2008-07-07T21:52:56 i have a union with a member of jsonObject. it's valid to cast an instance of the union into a jsonObject*? 2008-07-07T21:53:10 s/instance/pointer to an instance/ 2008-07-07T21:53:20 yes 2008-07-07T21:53:26 a union is a pun. 2008-07-07T21:53:33 gah 2008-07-07T21:53:34 you've got a bunch of overlays 2008-07-07T21:53:52 every "member" of a union starts at the same memory address. 2008-07-07T21:54:00 but it only holds one thing at a time. 2008-07-07T21:54:06 that part makes sense 2008-07-07T21:54:10 so, you need to know what's in it, somehow 2008-07-07T21:54:26 usually, a union is embedded in a struct that has a type-tag as the first field. 2008-07-07T21:54:31 (gah was for the baby troubles, btw, not berick ;) ) 2008-07-07T21:54:58 this is how perl, and most other dynamically typed languages implement types in the C. 2008-07-07T21:55:10 so unionPtr->field == (fieldType*) unionPtr 2008-07-07T21:55:28 yes... no 2008-07-07T21:55:30 berick: that code is in heavy use inside cstore-trunk, fwiw ... there's instrumentation that shows it working 2008-07-07T21:55:41 the storage part makes sense, but i thought you still had to access the data via the field name 2008-07-07T21:55:45 &(unionPtr->field) == (filedType *)unionPtr 2008-07-07T21:56:03 miker_: well, the instrumentation is logging integer counters, which doesn't fill me with confidence 2008-07-07T21:56:13 yes, you need to access the data using the field name. 2008-07-07T21:56:28 but that's not happening 2008-07-07T21:56:39 berick: does the fact that cstore uses (and reuses) hundreds of thousands of objects help? ;) 2008-07-07T21:56:43 'o' is a pointer to the union. 2008-07-07T21:56:47 bah. 2008-07-07T21:56:52 think about list management first. 2008-07-07T21:56:55 miker_: if your knowledge of that comes from the instrumentation, not really ;) 2008-07-07T21:57:09 berick: how about "dev cstore isn't segfaulting" 2008-07-07T21:57:10 I have a pointer to an object stored in the variable 'o' 2008-07-07T21:57:11 djfiander: no, o is the pointer to the jsonObject 2008-07-07T21:57:24 miker_: well, that helps for sure 2008-07-07T21:57:25 berick: no, o is a pointer to a union 2008-07-07T21:57:36 djfiander: where in the code? 2008-07-07T21:57:36 but you're using it as a pointer to the jsonObject. 2008-07-07T21:57:37 berick: o is a pointer to a blob of memory that is shaped like a jsonObject 2008-07-07T21:57:50 miker_: shh. one at a time, please 2008-07-07T21:57:53 heh 2008-07-07T21:58:24 Like I said, normally, the union is stored in a struct with a type tag. 2008-07-07T21:58:32 that's only necessary for complicated things. 2008-07-07T21:58:41 here, it's either on the free list, or it's not. 2008-07-07T21:58:57 ok, agreed, in jsonNewObject, o is a pointer to the union (if it's non-null) 2008-07-07T21:59:12 berick: right, and I cast it to a jsonObject pointer and return it to you 2008-07-07T21:59:20 ok 2008-07-07T21:59:36 so far so good 2008-07-07T21:59:37 so, you fiddle around in all of your code with this thing that you are treating as a jsonObject and everything is cool 2008-07-07T21:59:46 then you want to free it. 2008-07-07T22:00:07 so you pass it to jsonObjectFree 2008-07-07T22:00:16 but it's the thing I gave you 2008-07-07T22:00:23 so, I just turn it back into a pointer to a union 2008-07-07T22:00:24 or a jsonObject thingy 2008-07-07T22:00:42 pardon? 2008-07-07T22:01:17 in jsonObjectFree, if there were no jsonObjects lying around in the list, then a new jsonObject is created (not a union) and returned from jsonNewObject 2008-07-07T22:01:25 berick: all object creation and destruction must happen via jsonObject{New|Free} ... is that not the case in the translator? 2008-07-07T22:01:42 this would be easier with a whiteboard. 2008-07-07T22:01:55 berick: you mean s/Free/New/ 2008-07-07T22:02:17 miker_: the translator is not even at that low of a level.. so it's using whatever opensrf uses 2008-07-07T22:02:41 dbs: you here? 2008-07-07T22:02:49 djfiander: back 2008-07-07T22:02:57 do you understand this stuff? 2008-07-07T22:03:49 sorry, in jsonNewObject, if there are no idle jsonObjects in the free list, then a jsonObject is created (not a union instance) and returned. so, in jsonObjectFree you are "freeing" a jsonObject /or/ a union instance 2008-07-07T22:04:18 type-punning? void * FTW! 2008-07-07T22:04:19 berick: the difference between a jsonObject an a union object is the type of pointer I use to look at it 2008-07-07T22:04:19 berick: they're shaped the same. same size 2008-07-07T22:04:25 right 2008-07-07T22:04:30 miker_: well, there's one small difference. 2008-07-07T22:04:36 djfiander: not well enough to be of use 2008-07-07T22:05:10 If the alignment constraints for a pointer are stricter than for the jsonObject struct, you'll be screwed. But that's unlikely on any processor made by intel 2008-07-07T22:05:43 hah 2008-07-07T22:05:54 well, now 2008-07-07T22:06:32 berick: I wasn't being facetious. there are machines where pointers are big and alignment is a problem 2008-07-07T22:06:37 the malloc just gives you a pointer to a blob of memory that has sizeof(osrfObject) bytes in it 2008-07-07T22:06:49 is it an abuse to cast unions directly to objects and back or is that typical? 2008-07-07T22:06:52 er, jsonObject 2008-07-07T22:06:52 djfiander: oh, i know 2008-07-07T22:07:27 that's really the crux of my problem.. the casting 2008-07-07T22:07:35 berick: no. casting to objects is not normal. 2008-07-07T22:07:49 but we're not casting objects. we're casting pointers. 2008-07-07T22:07:53 and that is essential for unions. 2008-07-07T22:08:23 if u points to one of these unions, then 2008-07-07T22:08:25 berick: where are you casting an object? 2008-07-07T22:08:29 well, i use a union in the json code, but i always access the content via the field name and not by casting the union pointer 2008-07-07T22:08:41 miker_: i meant casting the pointer 2008-07-07T22:08:57 pointer's a pointer's a pointer 2008-07-07T22:09:21 *** kgs_away has quit IRC 2008-07-07T22:09:31 we've run 'er off! 2008-07-07T22:09:33 berick: the pointer returned by jsonObjectNew points to a jsonObject 2008-07-07T22:09:45 that's the only way you can use it, because that's what you asked for. 2008-07-07T22:10:12 so, you say jsonobjp->value.s to get to the string 2008-07-07T22:10:25 heh, unless you cast it into a Grapefruit* ;) 2008-07-07T22:10:39 right 2008-07-07T22:10:41 (notice the use of a union for type punning based on the jsonobjp->type field 2008-07-07T22:10:45 ) 2008-07-07T22:11:02 right, that's my approach to unions. use the ->field accessor 2008-07-07T22:11:35 so, when you pass that pointer to jsonObjectFree here's what happens: 2008-07-07T22:11:53 s = jsonobjp->value.s instead of saying s = (char*) jsonptr->value 2008-07-07T22:11:54 line 190: turn the jsonObject pointer into a union pointer. 2008-07-07T22:12:12 djfiander: i think i have a grasp on what it's doing 2008-07-07T22:12:21 use the union pointer to access the 'next' field of the union. and set it to the head of the linked list 2008-07-07T22:12:27 mostly just trying to determine if this is common programming practice, etc. 2008-07-07T22:12:34 (I just want to know what's different about cstore, auth and the router that it works for them ...(well, I actually want to know what's different about the translator)) 2008-07-07T22:12:40 berick: only when you're doing low-level memory management 2008-07-07T22:13:16 go look at the code for malloc() in the glibc; it'll do similar kinds of stuff. 2008-07-07T22:14:15 and there's no type tag here because it's free or it's not. so we know how to treat it based on free => union; allocated => jsonObject. 2008-07-07T22:14:29 miker_: well, that's my next step 2008-07-07T22:14:46 this code looks good. nice and simple. 2008-07-07T22:14:58 i suppose there a speed increase with (char*)ptr->value over ptr->value.s ? 2008-07-07T22:15:01 I suspect something in the caller 2008-07-07T22:15:19 berick: nope, none. the code generator will create identical code. 2008-07-07T22:15:23 i'm probably just freeing something i shouldn't 2008-07-07T22:15:27 the latter is better for documentation. 2008-07-07T22:15:56 but that's not what we're doing here with the unusedObj unions. 2008-07-07T22:16:31 berick: find some graph paper, draw out some squares of memory and use arrows to link stuff around and see how it works. 2008-07-07T22:16:43 it really is that low level 2008-07-07T22:17:05 yeah, i understand the pieces 2008-07-07T22:17:09 it solidified 2008-07-07T22:17:13 ok 2008-07-07T22:17:23 thank you, though. i needed that ;) 2008-07-07T22:17:47 now i feel better 2008-07-07T22:17:55 good. I have problems with some of the stunts you pull in perl. this is C's equivalent funky stunts. 2008-07-07T22:18:15 and I've been debugging memory management on baroque architectures since the '80s 2008-07-07T22:18:22 and now I really have to go 2008-07-07T22:18:40 *** djfiander has quit IRC 2008-07-07T22:18:40 heh 2008-07-07T22:20:33 best half hour of djfiander's time yet! 2008-07-07T22:35:13 *** dbs has quit IRC