<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 29, 2013 at 9:55 PM, Alan Coopersmith <span dir="ltr"><<a href="mailto:alan.coopersmith@oracle.com" target="_blank">alan.coopersmith@oracle.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Alan Coopersmith <<a href="mailto:alan.coopersmith@oracle.com">alan.coopersmith@oracle.com</a>><br>

---<br>
 src/FreeType/ftfuncs.c |    4 +---<br>
 src/FreeType/xttcap.c  |    3 +--<br>
 src/fontfile/fontdir.c |   10 +++-------<br>
 3 files changed, 5 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c<br>
index 091339d..2c90cf9 100644<br>
--- a/src/FreeType/ftfuncs.c<br>
+++ b/src/FreeType/ftfuncs.c<br>
@@ -2289,13 +2289,11 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,<br>
            }<br>
        }<br>
        else{<br>
-           *dynStrFTFileName = malloc(strlen(*dynStrRealFileName)+1);<br>
+           *dynStrFTFileName = strdup(*dynStrRealFileName);<br>
            if( *dynStrFTFileName == NULL ){<br>
                result = AllocError;<br>
                goto quit;<br>
            }<br>
-           **dynStrFTFileName = '\0';<br>
-           strcat(*dynStrFTFileName,*dynStrRealFileName);<br>
        }<br>
     }<br>
     /*<br>
diff --git a/src/FreeType/xttcap.c b/src/FreeType/xttcap.c<br>
index c1d8e67..104dc89 100644<br>
--- a/src/FreeType/xttcap.c<br>
+++ b/src/FreeType/xttcap.c<br>
@@ -234,14 +234,13 @@ SPropRecValList_add_record(SDynPropRecValList *pThisList,<br>
             {<br>
                 char *p;<br>
<br>
-                if (NULL == (p = malloc(strlen(strValue)+1))) {<br>
+                if (NULL == (p = strdup(strValue))) {<br>
                     fprintf(stderr,<br>
                             "truetype font property : "<br>
                             "cannot allocate memory.\n");<br>
                     result = True;<br>
                     goto quit;<br>
                 }<br>
-                strcpy(p, strValue);<br>
                 SPropContainer_value_str(&tmpContainerE) = p;<br>
             }<br>
             break;<br>
diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c<br>
index 97b2ba3..ef7ffa5 100644<br>
--- a/src/fontfile/fontdir.c<br>
+++ b/src/fontfile/fontdir.c<br>
@@ -425,17 +425,13 @@ FontFileCountDashes (char *name, int namelen)<br>
     return ndashes;<br>
 }<br>
<br>
+/* exported in public API in <X11/fonts/fntfil.h> */<br>
 char *<br>
 FontFileSaveString (char *s)<br>
 {<br>
-    char    *n;<br>
-<br>
-    n = malloc (strlen (s) + 1);<br>
-    if (!n)<br>
-       return 0;<br>
-    strcpy (n, s);<br>
-    return n;<br>
+    return strdup(s);<br>
 }<br>
+#define FontFileSaveString(s) strdup(s)<br></blockquote><div><br></div><div>Shouldn't this #define be in a header file to be useful? <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

 FontEntryPtr<br>
 FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat,<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.9.2<br>
<br>
_______________________________________________<br>
<a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>  Jasper<br>
</div></div>