Review Board 1.7.16


Convert pbx_spool to use string fields

Review Request #168 - Created Feb. 19, 2009 and submitted

Mark Michelson
/trunk
Reviewers
asterisk-dev
Asterisk
Simple. Convert all the static buffers used in pbx_spool to be string fields. This will dramatically lower the amount of memory used when processing a call file.
It compiles.

Changes between revision 1 and 3

1 2 3
1 2 3

  1. /trunk/pbx/pbx_spool.c: Loading...
/trunk/pbx/pbx_spool.c
Diff Revision 1 Diff Revision 3
[20] 89 lines
[+20] [+] static int init_outgoing(struct outgoing *o)
90
	o->priority = 1;
90
	o->priority = 1;
91
	o->retrytime = 300;
91
	o->retrytime = 300;
92
	o->waittime = 45;
92
	o->waittime = 45;
93
	o->format = AST_FORMAT_SLINEAR;
93
	o->format = AST_FORMAT_SLINEAR;
94
	ast_set_flag(&o->options, SPOOL_FLAG_ALWAYS_DELETE);
94
	ast_set_flag(&o->options, SPOOL_FLAG_ALWAYS_DELETE);
95
	if (!(ast_string_field_init(o, 128))) {
95
	if (ast_string_field_init(o, 128)) {
96
		return -1;
96
		return -1;
97
	}
97
	}
98
	return 0;
98
	return 0;
99
}
99
}
100

    
   
100

   
[+20] [20] 274 lines
[+20] [+] static int scan_service(char *fn, time_t now, time_t atime)
375
		ast_log(LOG_WARNING, "Out of memory ;(\n");
375
		ast_log(LOG_WARNING, "Out of memory ;(\n");
376
		return -1;
376
		return -1;
377
	}
377
	}
378
	
378
	
379
	if (init_outgoing(o)) {
379
	if (init_outgoing(o)) {

    
   
380
		/* No need to call free_outgoing here since we know the failure

    
   
381
		 * was to allocate string fields and no variables have been allocated

    
   
382
		 * yet.

    
   
383
		 */

    
   
384
		ast_free(o);
380
		return -1;
385
		return -1;
381
	}
386
	}
382

    
   
387

   
383
	/* Attempt to open the file */
388
	/* Attempt to open the file */
384
	if (!(f = fopen(fn, "r+"))) {
389
	if (!(f = fopen(fn, "r+"))) {
[+20] [20] 143 lines
  1. /trunk/pbx/pbx_spool.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.