rename BLI_getQuotedStr --> BLI_str_quoted_substrN to make it more clear its doing...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 9 Jul 2012 22:16:50 +0000 (22:16 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 9 Jul 2012 22:16:50 +0000 (22:16 +0000)
source/blender/blenkernel/intern/fcurve.c
source/blender/blenlib/BLI_string.h
source/blender/blenlib/intern/string.c
source/blender/editors/animation/anim_deps.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/anim_ipo_utils.c
source/blender/editors/armature/poseobject.c
source/blender/editors/transform/transform_conversions.c

index 38c1709d79a095b8972aae11cd14088d221396fc..97b245bd067637e1c712c7bad6e378c058f4e836 100644 (file)
@@ -285,12 +285,12 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix,
        for (fcu = src->first; fcu; fcu = fcu->next) {
                /* check if quoted string matches the path */
                if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) {
-                       char *quotedName = BLI_getQuotedStr(fcu->rna_path, dataPrefix);
+                       char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix);
                        
                        if (quotedName) {
                                /* check if the quoted name matches the required name */
                                if (strcmp(quotedName, dataName) == 0) {
-                                       LinkData *ld = MEM_callocN(sizeof(LinkData), "list_find_data_fcurves");
+                                       LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
                                        
                                        ld->data = fcu;
                                        BLI_addtail(dst, ld);
index 8fde8fcf13fed737b4bb19636744a56064d36c4d..a74629e589ca0605580bf9cae4f8cb1dd27ee2f6 100644 (file)
@@ -105,7 +105,7 @@ __attribute__((nonnull))
  * Assume that the strings returned must be freed afterwards, and that the inputs will contain
  * data we want...
  */
-char *BLI_getQuotedStr(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *str, const char *prefix)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
 __attribute__((nonnull))
index d86d151b1efebe481ffffcb05f59e86aacfffc70..7a750a74a33013b1d96a04ea23e0a4edb0cbe063 100644 (file)
@@ -168,8 +168,10 @@ escape_finish:
  *
  * Assume that the strings returned must be freed afterwards, and that the inputs will contain 
  * data we want...
+ *
+ * TODO, return the offset and a length so as to avoid doing an allocation.
  */
-char *BLI_getQuotedStr(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *str, const char *prefix)
 {
        size_t prefixLen = strlen(prefix);
        char *startMatch, *endMatch;
index 32cbbc794967d4d7202c40a95a911901fb88767b..50bdbd6673cbb95a188818f689c995bd157eb341 100644 (file)
@@ -178,7 +178,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
                        char *bone_name;
                        
                        /* get bone-name, and check if this bone is selected */
-                       bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
+                       bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
                        pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
                        if (bone_name) MEM_freeN(bone_name);
                        
@@ -201,7 +201,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
                        char *seq_name;
                        
                        /* get strip name, and check if this strip is selected */
-                       seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
+                       seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
                        seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
                        if (seq_name) MEM_freeN(seq_name);
                        
@@ -223,7 +223,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
                        char *node_name;
                        
                        /* get strip name, and check if this strip is selected */
-                       node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
+                       node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
                        node = nodeFindNodebyName(ntree, node_name);
                        if (node_name) MEM_freeN(node_name);
                        
index e239719d894b3c36e9f350c6aa6b4386ce19724c..6144cc4ecc1a4223df6ed8db40fba0077d9cff6a 100644 (file)
@@ -880,7 +880,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
                        char *bone_name;
                        
                        /* get bone-name, and check if this bone is selected */
-                       bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
+                       bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
                        pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
                        if (bone_name) MEM_freeN(bone_name);
                        
@@ -916,7 +916,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
                        char *seq_name;
                        
                        /* get strip name, and check if this strip is selected */
-                       seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
+                       seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
                        seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
                        if (seq_name) MEM_freeN(seq_name);
                        
@@ -936,7 +936,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
                        char *node_name;
                        
                        /* get strip name, and check if this strip is selected */
-                       node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
+                       node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
                        node = nodeFindNodebyName(ntree, node_name);
                        if (node_name) MEM_freeN(node_name);
                        
index 35782c3b3ae2d0c25f08b44cb146b75982b564a4..5295950546d9d6448872b56b43025a34afb67b6a 100644 (file)
@@ -104,8 +104,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
                         */
                        if (strstr(fcu->rna_path, "bones") && strstr(fcu->rna_path, "constraints")) {
                                /* perform string 'chopping' to get "Bone Name : Constraint Name" */
-                               char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
-                               char *constName = BLI_getQuotedStr(fcu->rna_path, "constraints[");
+                               char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
+                               char *constName = BLI_str_quoted_substrN(fcu->rna_path, "constraints[");
                                
                                /* assemble the string to display in the UI... */
                                structname = BLI_sprintfN("%s : %s", pchanName, constName);
index f837d8a726edac34221a6cb6dc97b6505d8bcdf3..cd2ca16fec5710fd8651b011d4d24055cc6f3644 100644 (file)
@@ -694,7 +694,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend)
                /* only items related to this object will be relevant */
                if ((ksp->id == &ob->id) && (ksp->rna_path != NULL)) {
                        if (strstr(ksp->rna_path, "bones")) {
-                               char *boneName = BLI_getQuotedStr(ksp->rna_path, "bones[");
+                               char *boneName = BLI_str_quoted_substrN(ksp->rna_path, "bones[");
                                
                                if (boneName) {
                                        bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName);
index d7241555cc7830f1f8cb547932ef33561a82ea9e..949266a0cc23fd41de65aba04bf023f4f01f2bc3 100644 (file)
@@ -4880,7 +4880,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
                                                for (fcu = act->curves.first; fcu; fcu = fcu->next) {
                                                        /* only insert keyframes for this F-Curve if it affects the current bone */
                                                        if (strstr(fcu->rna_path, "bones")) {
-                                                               char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
+                                                               char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
                                                                
                                                                /* only if bone name matches too... 
                                                                 * NOTE: this will do constraints too, but those are ok to do here too?