rdma/cma: minor code refactoring when saving a string content
PATCH 1/1 rdma/cma: minor code refactoring when saving a string content
In this case, using strdup will provide a cleaner code (and maybe a little bit faster too).
Signed-off-by Dotan Barak <[email protected]>
---
src/addrinfo.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
src/addrinfo.c +1 -3
@@ -137,9 +137,7 @@ static int ucma_convert_to_rai(struct rdma_addrinfo *rai,if (!addr)return ERR (ENOMEM ); - canonname = ai->ai_canonname ?malloc (strlen (ai->ai_canonname) +1 ) :NULL ; -if (canonname) -strcpy (canonname, ai->ai_canonname); + canonname = ai->ai_canonname ?strdup (ai->ai_canonname) :NULL ;memcpy (addr, ai->ai_addr, ai->ai_addrlen);if (ai->ai_flags &RAI_PASSIVE ) {
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 201110301348.05062.dotanb-g2bIKuvJtcQanlnWow0HJg@public.gmane.org
thanks - applied
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html