[Xfce4-commits] <postler:master> Use for() instead of foreach() to iterate emoticons

Christian Dywan noreply at xfce.org
Sat Nov 6 00:16:01 CET 2010


Updating branch refs/heads/master
         to 08b57081914d8903e89e888e415fe27743021ec8 (commit)
       from f38adcdf6331919591f37baed4b15f7158eccff3 (commit)

commit 08b57081914d8903e89e888e415fe27743021ec8
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Nov 5 23:54:25 2010 +0100

    Use for() instead of foreach() to iterate emoticons

 postler/postler-content.vala |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index abc562b..d8a6940 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -230,8 +230,7 @@ public class Postler.Content : WebKit.WebView {
 
     static bool evaluate_emoticon (GLib.MatchInfo     match_info,
                                    GLib.StringBuilder result,
-                                   void*              user_data) {
-        EmoticonMapping emoticon = *(EmoticonMapping*)user_data;
+                                   EmoticonMapping    emoticon) {
         Gdk.Pixbuf pixbuf = null;
         try {
             pixbuf = Gtk.IconTheme.get_for_screen (
@@ -739,12 +738,14 @@ public class Postler.Content : WebKit.WebView {
             }
 
             /* Emoticons */
-            foreach (var emoticon in emoticons) {
+            /* foreach (var emoticon in emoticons) { */
+            for (int i = 0; i < emoticons.length; i++) {
+                var emoticon = emoticons[i];
                 try {
                     var escaped = GLib.Regex.escape_string (" " + emoticon.token);
                     var regex = new GLib.Regex (escaped);
                     body_chunk = regex.replace_eval (body_chunk, -1, 0, 0,
-                        (match_info, result) => { evaluate_emoticon (match_info, result, &emoticon); });
+                        (match_info, result) => { evaluate_emoticon (match_info, result, emoticon); });
                 }
                 catch (GLib.RegexError error) { }
             }



More information about the Xfce4-commits mailing list