register.c (586B)
1 #include <stdlib.h> 2 #include <string.h> 3 4 #include "common.h" 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 extern struct Format *supercop_formats; 11 12 void __attribute__ ((constructor)) fmt_hdr_register() { 13 struct Format *fmt = calloc(1, sizeof(struct Format)); 14 if (!fmt) return; 15 fmt->next = supercop_formats; 16 fmt->name = calloc(1, 4); 17 if (!fmt->name) { 18 free(fmt); 19 return; 20 } 21 fmt->detect = fmt_hdr_detect; 22 fmt->encode = fmt_hdr_encode; 23 fmt->decode = fmt_hdr_decode; 24 supercop_formats = fmt; 25 strcpy(fmt->name, "hdr"); 26 } 27 28 #ifdef __cplusplus 29 } // extern "C" 30 #endif