svn rev #23376: trunk/src/include/

ghudson@MIT.EDU ghudson at MIT.EDU
Sat Nov 28 10:51:45 EST 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=23376
Commit By: ghudson
Log Message:
Add a convenience inline function in k5-int.h to initialize a
krb5_data structure with allocated memory.



Changed Files:
U   trunk/src/include/k5-int.h
Modified: trunk/src/include/k5-int.h
===================================================================
--- trunk/src/include/k5-int.h	2009-11-28 09:20:09 UTC (rev 23375)
+++ trunk/src/include/k5-int.h	2009-11-28 15:51:45 UTC (rev 23376)
@@ -2837,6 +2837,19 @@
     return make_data(str, strlen(str));
 }
 
+static inline krb5_error_code
+alloc_data(krb5_data *data, unsigned int len)
+{
+    char *ptr = (char *) calloc(len, 1);
+
+    if (ptr == NULL)
+        return ENOMEM;
+    data->magic = KV5M_DATA;
+    data->data = ptr;
+    data->length = len;
+    return 0;
+}
+
 static inline int
 data_eq_string (krb5_data d, char *s)
 {




More information about the cvs-krb5 mailing list