Mercurial > pidgin
comparison src/prefs.c @ 13710:848c9685ecc7
[gaim-migrate @ 16114]
CID 153
Same idea as CID 154: Do the sanity checks directly, in case g_return_if_fail()s are being compiled out.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 01 May 2006 20:31:25 +0000 |
parents | ff25f6d2b484 |
children | 8bda65b88e49 |
comparison
equal
deleted
inserted
replaced
13709:ff25f6d2b484 | 13710:848c9685ecc7 |
---|---|
913 gaim_prefs_rename(const char *oldname, const char *newname) | 913 gaim_prefs_rename(const char *oldname, const char *newname) |
914 { | 914 { |
915 struct gaim_pref *oldpref, *newpref; | 915 struct gaim_pref *oldpref, *newpref; |
916 | 916 |
917 oldpref = find_pref(oldname); | 917 oldpref = find_pref(oldname); |
918 newpref = find_pref(newname); | |
919 | 918 |
920 /* it's already been renamed, call off the dogs */ | 919 /* it's already been renamed, call off the dogs */ |
921 if(!oldpref) | 920 if(!oldpref) |
922 return; | 921 return; |
923 | 922 |
923 if (oldpref->first_child != NULL) /* can't rename parents */ | |
924 { | |
925 gaim_debug_error("prefs", "Unable to rename %s to %s: can't rename parents\n", oldname, newname); | |
926 return; | |
927 } | |
928 | |
929 | |
930 newpref = find_pref(newname); | |
931 | |
932 if (newpref == NULL) | |
933 { | |
934 gaim_debug_error("prefs", "Unable to rename %s to %s: new pref not created\n", oldname, newname); | |
935 return; | |
936 } | |
937 | |
938 if (oldpref->type != newpref->type) | |
939 { | |
940 gaim_debug_error("prefs", "Unable to rename %s to %s: differing types\n", oldname, newname); | |
941 return; | |
942 } | |
943 | |
924 gaim_debug_info("prefs", "Renaming %s to %s\n", oldname, newname); | 944 gaim_debug_info("prefs", "Renaming %s to %s\n", oldname, newname); |
925 | |
926 g_return_if_fail(newpref != NULL); /* the new one needs to be created first */ | |
927 g_return_if_fail(oldpref->type == newpref->type); | |
928 g_return_if_fail(oldpref->first_child == NULL); /* can't rename parents */ | |
929 | 945 |
930 switch(oldpref->type) { | 946 switch(oldpref->type) { |
931 case GAIM_PREF_NONE: | 947 case GAIM_PREF_NONE: |
932 break; | 948 break; |
933 case GAIM_PREF_BOOLEAN: | 949 case GAIM_PREF_BOOLEAN: |