you don't need the destructor if you aren't implementing one...use use
NS_IMPL_NSGETMODULE
+ nsresult ReadSystemPref(PRUint32 aPrefIndex);
Looking at the code, I don't see why you need ReadSystemPref to go through this
extra level of indirection of passing around an integer. Why can't this just
take const char*? it seems like it would simplify the code quite a bit.. for
instance:
+ for (PRInt16 index = 0; index < sysPrefLen; ++index) {
+ if (!strcmp(aTopic, sSysPrefList[index])) {
+ ReadSystemPref(index);
+ break;
+ }
+ }
Why do this whole loop? it seems like you could just say
ReadSystemPref(aTopic);
...if ReadSystemPref took the pref string directly.
and I think you do need to keep these lists in sync, look:
Comment on attachment 118391
patch (add Alecf's comments)
+PR_STATIC_ CALLBACK( void) uleDtor( nsIModule *aSelf) NSGETMODULE_ WITH_DTOR( nsSystemPrefMod ule, uleDtor)
+ nsSystemPrefMod
+{
+}
+
+NS_IMPL_
+ components,
+ nsSystemPrefMod
you don't need the destructor if you aren't implementing one...use use
NS_IMPL_NSGETMODULE
+ nsresult ReadSystemPref( PRUint32 aPrefIndex);
Looking at the code, I don't see why you need ReadSystemPref to go through this
extra level of indirection of passing around an integer. Why can't this just
take const char*? it seems like it would simplify the code quite a bit.. for
instance:
+ for (PRInt16 index = 0; index < sysPrefLen; ++index) { index]) ) { index);
+ if (!strcmp(aTopic, sSysPrefList[
+ ReadSystemPref(
+ break;
+ }
+ }
Why do this whole loop? it seems like you could just say
ReadSystemPref( aTopic) ;
...if ReadSystemPref took the pref string directly.
and I think you do need to keep these lists in sync, look:
+static const char* sSysPrefList[] = { proxy.http" , proxy.http_ port",
+ "network.
+ "network.
+};
and
Index: ./system- pref/src/ gconf/gconf_ pref_list. inc ======= ======= ======= ======= ======= ======= ======= ======= ==== proxy.http" , "/system/ http_proxy/ host"}, proxy.http_ port", "/system/ http_proxy/ port"},
=======
+ {"network.
+ {"network.
I just don't understand why you can't just use the 2nd list as your list of
prefs...
we're getting there...