diff options
author | Matt Turner <mattst88@gmail.com> | 2010-08-27 18:34:49 -0400 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2010-08-27 19:05:48 -0400 |
commit | 08adf41f6315663cbac33d010214d98f3e1c8814 (patch) | |
tree | 6589b58b25fe0cb1b1c58bb3f74058004f6fa230 /hw/kdrive/src | |
parent | ea239112b030588ed3cdd113643ba5f6207a5bd9 (diff) |
Replace malloc/strlen/strcpy with strdup.
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'hw/kdrive/src')
-rw-r--r-- | hw/kdrive/src/kxv.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c index c07829a5f..50dc23529 100644 --- a/hw/kdrive/src/kxv.c +++ b/hw/kdrive/src/kxv.c @@ -377,8 +377,7 @@ KdXVInitAdaptors( pa->ddGetPortAttribute = KdXVGetPortAttribute; pa->ddQueryBestSize = KdXVQueryBestSize; pa->ddQueryImageAttributes = KdXVQueryImageAttributes; - if((pa->name = malloc(strlen(adaptorPtr->name) + 1))) - strcpy(pa->name, adaptorPtr->name); + pa->name = strdup(adaptorPtr->name); if(adaptorPtr->nEncodings && (pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { @@ -388,8 +387,7 @@ KdXVInitAdaptors( { pe->id = encodingPtr->id; pe->pScreen = pScreen; - if((pe->name = malloc(strlen(encodingPtr->name) + 1))) - strcpy(pe->name, encodingPtr->name); + pe->name = strdup(encodingPtr->name); pe->width = encodingPtr->width; pe->height = encodingPtr->height; pe->rate.numerator = encodingPtr->rate.numerator; @@ -441,8 +439,7 @@ KdXVInitAdaptors( pat->flags = attributePtr->flags; pat->min_value = attributePtr->min_value; pat->max_value = attributePtr->max_value; - if((pat->name = malloc(strlen(attributePtr->name) + 1))) - strcpy(pat->name, attributePtr->name); + pat->name = strdup(attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; pa->pAttributes = pAttribute; |