Changeset 6668
- Timestamp:
- 01/02/11 19:16:54 (2 years ago)
- Files:
-
- 1 modified
-
luci/trunk/libs/lmo/src/lmo_po2lmo.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/libs/lmo/src/lmo_po2lmo.c
r5487 r6668 2 2 * lmo - Lua Machine Objects - PO to LMO conversion tool 3 3 * 4 * Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org>4 * Copyright (C) 2009-2011 Jo-Philipp Wich <xm@subsignal.org> 5 5 * 6 6 * Licensed under the Apache License, Version 2.0 (the "License"); … … 60 60 off++; 61 61 esc = 1; 62 63 62 } 64 63 else if( src[pos] != '"' ) … … 86 85 int offset = 0; 87 86 int length = 0; 87 uint32_t key_id, val_id; 88 88 89 89 FILE *in; … … 156 156 if( strlen(key) > 0 && strlen(val) > 0 ) 157 157 { 158 if( (entry = (lmo_entry_t *) malloc(sizeof(lmo_entry_t))) != NULL ) 158 key_id = sfh_hash(key, strlen(key)); 159 val_id = sfh_hash(val, strlen(val)); 160 161 if( key_id != val_id ) 159 162 { 160 memset(entry, 0, sizeof(entry)); 161 length = strlen(val) + ((4 - (strlen(val) % 4)) % 4); 162 163 entry->key_id = htonl(sfh_hash(key, strlen(key))); 164 entry->val_id = htonl(sfh_hash(val, strlen(val))); 165 entry->offset = htonl(offset); 166 entry->length = htonl(strlen(val)); 167 168 print(val, length, 1, out); 169 offset += length; 170 171 entry->next = head; 172 head = entry; 173 } 174 else 175 { 176 die("Out of memory"); 163 if( (entry = (lmo_entry_t *) malloc(sizeof(lmo_entry_t))) != NULL ) 164 { 165 memset(entry, 0, sizeof(entry)); 166 length = strlen(val) + ((4 - (strlen(val) % 4)) % 4); 167 168 entry->key_id = htonl(key_id); 169 entry->val_id = htonl(val_id); 170 entry->offset = htonl(offset); 171 entry->length = htonl(strlen(val)); 172 173 print(val, length, 1, out); 174 offset += length; 175 176 entry->next = head; 177 head = entry; 178 } 179 else 180 { 181 die("Out of memory"); 182 } 177 183 } 178 184 }
