From: Christophe CURIS <[email protected]>

The original code called gettext twice every time, the new code calls it
only once.

Signed-off-by: Christophe CURIS <[email protected]>
---
 src/workspace.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/workspace.c b/src/workspace.c
index 4e619ef..1365cc9 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -94,8 +94,15 @@ int wWorkspaceNew(WScreen *scr)
                wspace->clip = NULL;
 
                if (!wspace->name) {
-                       wspace->name = wmalloc(strlen(_("Workspace %i")) + 8);
-                       sprintf(wspace->name, _("Workspace %i"), 
w_global.workspace.count);
+                       static const char *new_name = NULL;
+                       static size_t name_length;
+
+                       if (new_name == NULL) {
+                               new_name = _("Workspace %i");
+                               name_length = strlen(new_name) + 8;
+                       }
+                       wspace->name = wmalloc(name_length);
+                       snprintf(wspace->name, name_length, new_name, 
w_global.workspace.count);
                }
 
                if (!wPreferences.flags.noclip)
-- 
1.8.4.rc3


-- 
To unsubscribe, send mail to [email protected].

Reply via email to