|
From: Daniel G. <go...@b1...> - 2009-10-29 13:59:39
|
On Wednesday 28 October 2009 08:51:03 pm Jakub Marczyński wrote: > I started my "devel path" from looking through the osynctool.c > (http://svn.opensync.org/osynctool/trunk/tools/osynctool.c) Cool, thanks for joining us! ;) > > And now (at the very beginning) I have some questions: > > 1. Function [line: 164]: > static osync_bool osynctool_list_formats(OSyncFormatEnv *env, OSyncError > **error) > > Argument "error" is never used in the function. Will it be needed in the > future? Do we consider as a bug? First of all ... osynctool_ is not part of the OpenSync API. It's only osynctool code ... Also keep in mind osynctool is "only" an implementation reference and a tool for tests/developers to test the OpenSync API ... But back to the actual topic ... osynctool_list_formts never calls a function which may raise an expection or so which fills a OSyncError struct ... So actually osynctool could be changed to: void osynctool_list_formats(OSyncFormatenv *env) It's not a bug - just obsolete, ugly code in osynctool - not OpenSync ;) > > 2. Some function return "void" and use "osync_trace", while other return > "osync_bool" (and do not trace). Are there any specific rules? When do we > need trace? Since osynctool stands for all other application based on the OpenSync API, you can use what ever debugging/tracing API you want to use. E.g. use QDebug or something else ... outside of OpenSync API code you don't have to use osync_trace ... Same for plugins, you don't have to use osync_trace() .. but you can if you like. The rules for code inside the OpenSync API: there is none. We usually place osync_trace() in complex function, to have some helpers to diagnose bug reports ... if you debug a problem and you think it would be handy in future to have some osync_trace() in this function to debug similar issues in the future more easily, don't hesistate to add one. But there is no requirement that we put on every single function call osync_trace(TRACE_ENTRY) osync_trace(TRACE_EXIT) ... In fact too much osync_trace() calls have bad impact on performance if tracing is enabled ... but for that we have also helpers to temporarily disable tracing osync_trace_enable() osync_trace_disable() ... e.g. for (quick) loops which get called pretty often ... > "osynctool_list_formats" and "osynctool_list_plugins" seem to be very > similar, but they behave differently in this matter. Right, osync_list_formats should look like osync_list_formats ... if you like you can provide a patch for that ;) > > > Thanks in advance for answering my questions. I promise there will be some > more ;) Cool - pretty good question. Looking forward to more questions and of course to your patches ;) Best Regards, Daniel -- Daniel Gollub Geschaeftsfuehrer: Ralph Dehner FOSS Developer Unternehmenssitz: Vohburg B1 Systems GmbH Amtsgericht: Ingolstadt Mobil: +49-(0)-160 47 73 970 Handelsregister: HRB 3537 EMail: go...@b1... http://www.b1-systems.de Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0xED14B95C2F8CA78D |