cnum, fnum and snum

Andrew Tridgell tridge at
Fri Aug 14 07:20:04 GMT 1998

One of the things that has led to some really gross code in Samba in
the ubiquitous use of cnum, snum and fnum. In smbd specific code these
were fine but they have drifted into lots of utilitity functions (such
as standard_sub()). The result is that we need lots of silly dummy
definitions of Connections[] Files[] etc in weird places. 

I hit a particularly bad situation like this when trying to split the
printing code into separate PRINTING_OBJ used only by smbd and
testprns. To fix it I have decided that we should abandon the use of
the integer indexes and instead move to structure pointers. So for
	void standard_sub(int cnum,char *str);
	void standard_sub(connection_struct *conn,char *str);

this had a large amount of flow on consequences that I am still
dealing with, but I think the pain will be worth it. 

I hope we will eventually get rid of cnum, fnum etc from the code and
use structure pointers throughout. 

More information about the samba-technical mailing list